Arduino Programming
- raghuramansanjana
- Nov 10, 2022
- 1 min read
Updated: Dec 17, 2022
In this page I will describe:
There are 4 tasks that will be explained in this page:
Input devices:
Interface a potentiometer analog input to maker UNO board and measure/show its signal in serial monitor Arduino IDE.
Interface a LDR to maker UNO board and measure/show its signal in serial monitor Arduino IDE
Output devices:
Interface 3 LEDs (Red, Yellow, Green) to maker UNO board and program it to perform something (fade or flash etc)
Include the pushbutton on the MakerUno board to start/stop part 2.a. above
For each of the tasks, I will describe:
The program/code that I have used and explanation of the code. The code is in writable format (not an image).
The sources/references that I used to write the code/program.
The problems I encountered and how I fixed them.
The evidence that the code/program worked in the form of video of the executed program/code.
code | explanation |
int sensorPin = A0; int ledPin = 13; int sensorValue = 0; void setup() { pinMode(ledPin,OUTPUT); } void loop() { sensorValue = analogRead(sensorPin); digitalWrite(ledPin, HIGH); delay(sensorValue); digitalWrite(ledPin, LOW); delay(sensorValue); } | Inside void setup, the pinmode function is used to establish A0 as an input and digital pin 13 as an output. Pin 13 is reflected as LED_BUILTIN on the code.
|
Comments