projets:fuz:webduino
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
projets:fuz:webduino [2019-05-22 16:07] – created Thio | projets:fuz:webduino [2019-12-29 11:24] – [Platformio] Lomanic | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Webduino ====== | + | ====== Webduino |
<WRAP round box 60%> | <WRAP round box 60%> | ||
===== Goals ===== | ===== Goals ===== | ||
* [OK] Flash Webduino with different IDEs | * [OK] Flash Webduino with different IDEs | ||
- | * Use serial Monitor | + | * [OK] Check Components : pins, photocell, RGB LED, button |
- | * Check pins, photocell, RGB LED, button | + | * [OK?] Use OTA |
- | * Use OTA | + | |
</ | </ | ||
===== Description ===== | ===== Description ===== | ||
- | * Webduino USB port is only used to power the board, not for upload and monitoring | ||
- | * The chip is labelled ESP8266MOD by AI Thinker, in fact it is an ESP-12F, same as Wemos d1 | ||
* [[https:// | * [[https:// | ||
+ | * 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 board includes a photocell, an RGB led and a button. | ||
+ | * [[https:// | ||
===== Wiring and flashing ===== | ===== Wiring and flashing ===== | ||
- | Plug Webduino Smart using FTDI **3.3v** module | + | Plug Webduino Smart using FTDI **3.3v** module. Webduino and the FTDI must be powered. Webduino is powered through its micro USB port. |
- | 3.3 3.3 | + | |
- | ftdi Tx | + | |
- | | + | |
| | ||
- | For **flashing**, | + | {{: |
+ | |||
+ | For **flashing**, | ||
For **rebooting**, | For **rebooting**, | ||
- | Flashing usual sequence is : | + | Flashing usual sequence is: |
- Set flash position (GPIO0 on GND) | - Set flash position (GPIO0 on GND) | ||
- Power the FTDI and the Webduino | - Power the FTDI and the Webduino | ||
- | - Upload sketch ... Webduino should restart in normal mode | + | |
- | - Disconnect flash position (GPIO0) | + | |
- | - Disconnect FTDI | + | - Or disconnect GPIO 0 and restart using RST or Webduino power |
- | - RST or repower the FTDI | + | |
===== Arduino IDE ===== | ===== Arduino IDE ===== | ||
Line 43: | Line 44: | ||
===== Platformio ===== | ===== Platformio ===== | ||
- | Got it to work as a Wemos d1 ! | + | Got it to work as a Wemos d1! |
[env:d1] | [env:d1] | ||
Line 49: | Line 50: | ||
board = d1 | board = d1 | ||
framework = arduino | framework = arduino | ||
- | |||
- | ===== Serial Monitor ===== | ||
- | |||
- | I could not get it to work yet :/ | ||
===== Components ===== | ===== Components ===== | ||
I got blink sketch using LED_BUILTIN (2) | I got blink sketch using LED_BUILTIN (2) | ||
+ | |||
+ | ==== RGB LED ==== | ||
+ | |||
+ | <code c++> | ||
+ | /*** | ||
+ | RGB sketch for webduino smart | ||
+ | | ||
+ | |||
+ | */ | ||
+ | |||
+ | #include < | ||
+ | |||
+ | // according to https:// | ||
+ | #define GPIO_GREEN_RGB 12 | ||
+ | #define GPIO_BLUE_RGB | ||
+ | #define GPIO_RED_RGB 15 | ||
+ | #define GPIO_MICRO_SWITCH_BUTTON 4 | ||
+ | |||
+ | // https:// | ||
+ | void RGB_color(int red_light_value, | ||
+ | analogWrite(GPIO_RED_RGB, | ||
+ | analogWrite(GPIO_GREEN_RGB, | ||
+ | analogWrite(GPIO_BLUE_RGB, | ||
+ | } | ||
+ | |||
+ | void showColor(int color) { | ||
+ | Serial.printf(" | ||
+ | switch (color) { | ||
+ | case 0: | ||
+ | RGB_color(255, | ||
+ | break; | ||
+ | case 1: | ||
+ | RGB_color(0, | ||
+ | break; | ||
+ | case 2: | ||
+ | RGB_color(255, | ||
+ | break; | ||
+ | case 3: | ||
+ | RGB_color(0, | ||
+ | break; | ||
+ | case 4: | ||
+ | RGB_color(255, | ||
+ | break; | ||
+ | case 5: | ||
+ | RGB_color(255, | ||
+ | break; | ||
+ | case 6: | ||
+ | RGB_color(255, | ||
+ | default: | ||
+ | RGB_color(0, | ||
+ | } | ||
+ | } | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(115200); | ||
+ | delay(10); | ||
+ | Serial.println(); | ||
+ | Serial.println(F(" | ||
+ | |||
+ | pinMode(GPIO_GREEN_RGB, | ||
+ | pinMode(GPIO_BLUE_RGB, | ||
+ | pinMode(GPIO_RED_RGB, | ||
+ | } | ||
+ | |||
+ | int color = 0; | ||
+ | void loop() { | ||
+ | if (digitalRead(GPIO_MICRO_SWITCH_BUTTON) == LOW) { | ||
+ | Serial.println(F(" | ||
+ | color = ((color + 1) % 7); | ||
+ | showColor(color); | ||
+ | delay(200); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Photocell ==== | ||
+ | <code c++> | ||
+ | |||
+ | /*** | ||
+ | | ||
+ | | ||
+ | |||
+ | */ | ||
+ | |||
+ | #include < | ||
+ | |||
+ | // according to https:// | ||
+ | #define GPIO_PHOTOCELL A0 | ||
+ | #define GPIO_MICRO_SWITCH_BUTTON 4 | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(115200); | ||
+ | delay(10); | ||
+ | Serial.println(); | ||
+ | Serial.println(F(" | ||
+ | } | ||
+ | void loop() { | ||
+ | if (digitalRead(GPIO_MICRO_SWITCH_BUTTON) == LOW) { | ||
+ | Serial.println(analogRead(GPIO_PHOTOCELL)); | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | ===== OTA ===== | ||
+ | See https:// |
projets/fuz/webduino.txt · Last modified: 2023-02-02 22:06 by 127.0.0.1