/*
Lenny Shpolanski, student #300237924
ENGR 1190 Midterm
Pushbutton circuits that generate a logic high are connected to digital pins:
2 - Button A (Red)
12 - Button B (Green)
8 - Button C (Blue)
7 - Button D (Yellow)
LED circuits are on the following digital pins:
5 - Orange LED
6 - Blue LED
9 - Red LED
10 - Green LED
Servo control line is on digital pin 11
*/
#include <Servo.h> //Includes servo library
Servo wiggly; //Creates servo object named "wiggly"
void setup()
{
// put your setup code here, to run once:
//designate pushbuttons pins as inputs
pinMode(2, INPUT);
pinMode(12, INPUT);
pinMode(8, INPUT);
pinMode(7, INPUT);
//designate LED pins as outputs
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
//designate pin 11 as the servo PWM pin
wiggly.attach(11);
}
int once = 1; //Makes a variable so that certain actions only exicute once
void loop()
{
// put your main code here, to run repeatedly:
//This if statement will only exicute once when the program starts
if(once == 1)
{
//Turn all LEDs off
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
//Changes the once variable so that this if statement never exicutes again
once = 0;
}
}