Week 05
Computer Engineering, Sensors, Digital Input Output, Analog Input Output












"The most commonly preferred language used to develop the drivers and OS / Kernel is Embedded C with XML . "


Sensors convert various forms of physical energy into electrical energy, allowing microcontrollers to read changes in the physical world.
void setup() {
// declare pin 2 to be an input:
pinMode(2, INPUT);
declare pin 3 to be an output:
pinMode(3, OUTPUT);
}
void loop() {
// read pin 2:
if (digitalRead(2) == 1) {
// if pin 2 is HIGH, set pin 3 HIGH:
digitalWrite(3, HIGH);
} else {
// if pin 2 is LOW, set pin 3 LOW:
digitalWrite(3, LOW);
}


Led ON/OFF

.png?alt=media&token=8d2f295b-4d82-468d-b8d5-3688d983bdf7)
You can dim an LED with the same circuit as you used for digital output. Just use analogWrite() on the pin to which the LED is connected.
Last modified 4yr ago