WIRING DIAGRAMS
Digital Layout
Physical Build
MATERIALS USED
Building blocks for our mechanical wonder.
CODE USED
void setup() { // Set digital pin 8 as an output pinMode(8, OUTPUT); } void loop() { // Declare and initialize variable i int i; // Continuous loop while (1) { // Read the voltage value from analog pin 5 i = analogRead(A5); // Check if the voltage is greater than 2.5V (512 in analogRead) if (i > 512) { // Turn on the LED connected to digital pin 8 digitalWrite(8, LOW); } else { // Turn off the LED connected to digital pin 8 digitalWrite(8, HIGH); } } }
SCHEMATIC