User Tools

Site Tools


projets:fuz:webduino

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
projets:fuz:webduino [2019-12-03 21:28] – [Components] document RGB LED Lomanicprojets:fuz:webduino [2019-12-04 01:39] – [RGB LED] Lomanic
Line 12: Line 12:
   * [[https://webduino.io/en/tutorials/smart-01-information.html|Official Intro]]   * [[https://webduino.io/en/tutorials/smart-01-information.html|Official Intro]]
   * Webduino USB port is only used to power the board, not for upload and monitoring   * Webduino USB port is only used to power the board, not for upload and monitoring
-  * The chip is labeled ESP8266MOD by AI Thinker, in fact it is an ESP-12F, same as Wemos d1 +  * The chip is labeled ESP8266MOD by AI Thinker, in fact it is an ESP-12F, same as Wemos D1 
-  * The Board include a photocell, RGB led and a button.+  * The board includes a photocell, an RGB led and a button.
   * [[https://www.programmersought.com/article/1565534775/|Unofficial tutorial in ~english]], with how to flash webduino with FTDI   * [[https://www.programmersought.com/article/1565534775/|Unofficial tutorial in ~english]], with how to flash webduino with FTDI
  
Line 91: Line 91:
       RGB_color(255, 255, 125); // Raspberry       RGB_color(255, 255, 125); // Raspberry
       break;       break;
-    case 3: // CYAN+    case 3:
       RGB_color(0, 255, 255); // Cyan       RGB_color(0, 255, 255); // Cyan
       break;       break;
-    case 4: // BLUE?+    case 4:
       RGB_color(255, 0, 255); // Magenta       RGB_color(255, 0, 255); // Magenta
       break;       break;
-    case 5: // GREEN+    case 5:
       RGB_color(255, 255, 0); // Yellow       RGB_color(255, 255, 0); // Yellow
       break;       break;
Line 125: Line 125:
     showColor(color);     showColor(color);
     delay(200);     delay(200);
 +  }
 +}
 +</code>
 +
 +==== Photocell ====
 +<code c++>
 +
 +/***
 +   Photocell sketch for webduino smart
 +   Board:   ESP8266
 +
 +*/
 +
 +#include <Arduino.h>
 +
 +// according to https://webduino.io/en/tutorials/smart-01-information.html#on-board-components-and-pins
 +#define GPIO_PHOTOCELL A0
 +#define GPIO_MICRO_SWITCH_BUTTON 4
 +
 +void setup() {
 +  Serial.begin(115200);
 +  delay(10);
 +  Serial.println();
 +  Serial.println(F("Webduino photocell sketch: push the micro switch button to read photocell values"));
 +}
 +
 +
 +void loop() {
 +  if (digitalRead(GPIO_MICRO_SWITCH_BUTTON) == LOW) {
 +    Serial.println(analogRead(GPIO_PHOTOCELL)); // values go from 0 for complete darkness to 1024 for full bright light
   }   }
 } }
projets/fuz/webduino.txt · Last modified: 2023-02-02 22:06 by 127.0.0.1