Kit Task 1 - Blinking LED Code: int ledPin = 12; void setup() { pinMode( ledPin , OUTPUT); // Set pin 12 to output } void loop() { digitalWrite( ledPin , HIGH); // Turn on the LED delay( 1000 ); // Wait for 1 second digitalWrite( ledPin , LOW); // Turn off the LED delay( 500 ); // Wait for 500ms } Changed LED pinout, so only the breadboard LED blinks. Made a single integer variable for the LED pin to reduce repeating code. Changed the delays so the LED stays on for twice as long as it is off. Kit Task 2 - Potentiometer Code : int ledPin = 12; int potPosition; //this variable will hold a value based on the position of the potentiometer void setup() { Serial.begin(9600); //start a serial connection with the computer pinMode( ledPin , OUTPUT); //set pin 12 as an output that can be set to HIGH or LOW } void loop() { //read the position of the pot potPosition = anal
Posts
Showing posts from May, 2018