Microcontroller 101

From XPUB & Lens-Based wiki

ḿ̬̏ͤͅỉ͔͖̜͌c͕͗ͤ̕̕r̴̨̦͕̝o̯̱̊͊͢c͕͗ͤ̕̕o̯̱̊͊͢ṇ̤͛̒̍t̲̂̓ͩ̑r̴̨̦͕̝o̯̱̊͊͢l̙͖̑̾ͣl̙͖̑̾ͣẹ̿͋̒̕r̴̨̦͕̝ 1̨̹̦͍̀0̗̜͕̅̃1̨̹̦͍̀
                                                                 

09-04-2024 e͎l͎e͎c͎t͎r͎i͎c͎

https://pzwiki.wdka.nl/mw-mediadesign/images/7/7e/Cricket.mp4

sensors and actuators


introduction to Arduino

LOLIN 32 Installation party :~)

Wemos LOLIN32 - ESP32

step 1: download Arduino software

step 2: download driver for microcontroller

step 3: install driver

_windows: open Device Manager >> find UART device >> right click and update driver >> select driver

Hello World!

in the Arduino program, select the correct board (WEMOS LOLIN32) and select the USB port you are using (if you are unsure, check the listed ports, unplug and see what changed)

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println("Hello World!");   //sends a message to the computer
}

Simple Led blink example

int ledPin = 13;               //the int ledPin is 13

void setup() {
  pinMode(ledPin,OUTPUT);      //ledPin is a OUTPUT
}

void loop() {
  digitalWrite(ledPin,HIGH);   //turns pin 13 on
  delay(500);                  //stops the loop for 500 milliseconds
  digitalWrite(ledPin,LOW);    //turns pin 13 off
  delay(500);                  //stops the loop for 500 milliseconds
}

Traffic light example

int RedLedPin = 13;                 //the int RedLedPin is 13
int GreenLedPin = 12;               //the int GreenLedPin is 12

void setup() {
  pinMode(RedLedPin,OUTPUT);        //ledPin is a OUTPUT
  pinMode(GreenLedPin,OUTPUT);      //ledPin is a OUTPUT

}

void loop() {
  digitalWrite(GreenLedPin,HIGH);   //turns green led  on
  delay(5000);                      //stops the loop for 5000 milliseconds
  for(int i = 0; i < 5; i++){       //this for loop gets 5 times repeated
    digitalWrite(GreenLedPin,LOW);  //turns green led off
    delay(500);                     //stops the loop for 500 milliseconds
    digitalWrite(GreenLedPin,HIGH); //turns green led off
    delay(500);                     //stops the loop for 500 milliseconds
  }
  digitalWrite(GreenLedPin,LOW);    //turns green led off
  digitalWrite(RedLedPin,HIGH);     //turns red led on
  delay(5000);                      //stops the loop for 5000 milliseconds
  digitalWrite(RedLedPin,LOW);      //turns red led on
}

LDR example

Poti example

Poti & speaker example

Button & alarm example

how to document

>> template:

title

This sketch does this

components list

>>for example: Wemos Lolin32
Led
220ohm resistor
type of sensor

schematic drawing

File:Your pic

arduino code


16-04-24

23-04-24 l͓̽i͓̽n͓̽k͓̽i͓̽n͓̽g͓̽ t͓̽h͓̽e͓̽ r͓̽e͓̽a͓̽l͓̽m͓̽s͓̽