This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int LED = 13; | |
void setup() { | |
pinMode(LED, OUTPUT); //initializes port(13) | |
} | |
void loop() { | |
digitalWrite(13,HIGH); //writes to (port, voltage) | |
delay(1000); //delay in milliseconds | |
digitalWrite(13,LOW); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int LED = 13; // port of LED | |
const int Button = 7; // port of button | |
int val = 0; // state of the button | |
int state = 0; //0=LED off // 1 =LED on | |
void setup() { | |
pinMode(LED, OUTPUT); //LED(port 13) is output | |
pinMode(Button, INPUT); //Button(port 7) is input | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int LED = 13; //LED is in port 13 | |
const int BUTTON = 7; //BUTTON is in port 7 | |
int val = 0; //state of the button | |
int old_val = 0; //previous state of button | |
int state = 0; // 0 = LED off // 1 = LED on | |
void setup(){ | |
pinMode(LED, OUTPUT); //port 13 is set to output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int LED = 13; //LED is in port 13 | |
const int BUTTON = 7; //BUTTON is in port 7 | |
int val = 0; //state of the button | |
int old_val = 0; //previous state of button | |
int state = 0; // 0 = LED off // 1 = LED on | |
void setup(){ | |
pinMode(LED, OUTPUT); //port 13 is set to output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int LED = 13; //LED is in port 13 | |
const int LED_G = 12; //LED green is in port 12 | |
const int LED_Y = 8; //LED yellow is in port 8 | |
const int BUTTON = 7; //BUTTON is in port 7 | |
int val = 0; //state of the button | |
int old_val = 0; //previous state of button | |
int state = 0; // 0 = LED off // 1 = LED on | |
int stage = 0; // 0 = red // 1 = green // 2 = yellow // 3 = all off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//blink LED at rate specified by analog input from light resistor | |
int light_resistor = 0; | |
int LED = 13; | |
int i = 0; //level of resistance from light_resistor | |
void setup() { | |
Serial.begin(9600); //begin serial communication | |
pinMode(light_resistor, INPUT); | |
pinMode(LED, OUTPUT); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//blink LED at rate specified by analog input from light resistor | |
//analogue input gives numbers between 0-1033 | |
//analogue output expects numbers between 0-255 | |
int light_resistor = 0; //light resistor port | |
int LED = 9; //LED port | |
int i = 0; //level of resistance from light_resistor | |
void setup() { | |
Serial.begin(9600); //begin serial communication |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int tempPin = 9;//temperature sensor is in pin 0 | |
float tempC = 0; //stores temperature sensor input data | |
void setup() { | |
analogReference(INTERNAL); | |
Serial.begin(9600); //opens serial communication | |
pinMode(tempPin, INPUT); | |
} | |
void loop() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Take analogue readings from four temperature sensors (LM35). When temperature increases sufficiently (hand touches | |
//sensor), light up one LED. Each sensor has it's own LED. | |
//variables for storing the reading, then converting reading to celsius | |
int reading0; | |
int reading1; | |
int reading2; | |
int reading3; | |
float tempC0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Take analogue readings from four temperature sensors (LM35). When temperature increases sufficiently (hand touches | |
//sensor), light up one LED. Each sensor has it's own LED. | |
//cycle count | |
int cycle = 0; | |
//variables for storing the reading, then converting reading to celsius | |
int reading0; | |
int reading1; | |
int reading2; |
OlderNewer