Prispevki ESP

ESP32 in Blink program v Arduino Web editor-ju

ESP32 in Blink

Za prve korake programiranja ESP krmilnikov je mogoče uporabiti kar spletni Arduino Web Editor – spletno verzijo Arduino IDE. Tako se namreč izognemo ročnemu dodajanju gonilnikov za ESP32 krmilnik. Tam je namreč že vse pripravljeno in posodobljeno.

Za krmilnik izberemo: MH ET LIVE ESP32DevKIT

Primer: Priklop treh LED diod na 30 pinski ESP32

Osnove dela z Arduino Web Editor okoljem.

Izgled programa Arduino Web Editor v brskalniku.

Arduino Web Editor

Uporabljen material:

  • ESP32 30 pin
  • 3x 220 ohm upor
  • povezovalne vezice
  • mikro USB kabel (za napajanje in programiranje)
ESP32 in Blink
				
					/*
  Blink na ESP32 30pin
  MH ET LIVE ESP32DevKIT
*/

int led1 = 19;
int led2 = 21;
int led3 = 22;
int hitrost = 100;

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);  
}

// the loop function runs over and over again forever
void loop() {
  //zelena
  digitalWrite(led1, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(hitrost);                      // wait for a second
  digitalWrite(led1, LOW);   // turn the LED off by making the voltage LOW
  delay(hitrost);                      // wait for a second

  digitalWrite(led2, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(hitrost);                      // wait for a second
  digitalWrite(led2, LOW);   // turn the LED off by making the voltage LOW
  delay(hitrost);    
  
  digitalWrite(led3, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(hitrost);                      // wait for a second
  digitalWrite(led3, LOW);   // turn the LED off by making the voltage LOW
  delay(hitrost);    

  digitalWrite(led2, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(hitrost);                      // wait for a second
  digitalWrite(led2, LOW);   // turn the LED off by making the voltage LOW
  delay(hitrost);    
}