projets:fuz:webduino
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
projets:fuz:webduino [2019-11-30 23:53] – [Webduino Smart] Lomanic | projets:fuz:webduino [2019-12-03 21:40] – [Photocell] Lomanic | ||
---|---|---|---|
Line 27: | Line 27: | ||
{{: | {{: | ||
- | For **flashing**, | + | For **flashing**, |
For **rebooting**, | For **rebooting**, | ||
Line 34: | Line 34: | ||
- Set flash position (GPIO0 on GND) | - Set flash position (GPIO0 on GND) | ||
- Power the FTDI and the Webduino | - Power the FTDI and the Webduino | ||
+ | - (RGB goes light blue) Disconnect GPIO 0 | ||
- Upload sketch... Webduino should restart in normal mode. | - Upload sketch... Webduino should restart in normal mode. | ||
- Or disconnect GPIO 0 and restart using RST or Webduino power | - Or disconnect GPIO 0 and restart using RST or Webduino power | ||
Line 54: | Line 55: | ||
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: // CYAN | ||
+ | RGB_color(0, | ||
+ | break; | ||
+ | case 4: // BLUE? | ||
+ | RGB_color(255, | ||
+ | break; | ||
+ | case 5: // GREEN | ||
+ | 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 ===== | ===== OTA ===== | ||
See https:// | See https:// |
projets/fuz/webduino.txt · Last modified: 2023-02-02 22:06 by 127.0.0.1