Wifi Witty ESP-12F Board
I’ve just received one of these Wifi Witty AKA Gizwits ESP-12F boards.
The board is in two parts – one part has reset/flash buttons, a CH341 UART and female headers; the other half has USB for power only, a button (which appears to be an input, not reset or flash) and male headers which take up an entire breadboard.
Despite having flash/reset buttons I can only seem to program it from the Arduino IDE with the NodeMCU v1.0 profile which does the DTR reset thing, pressing/holding the flash button seems to do nothing if I try the generic board profile, although some have said that its starts in flash mode as soon as you plug it in.
When I first plugged the device in, the RGB LED was changing colour very slowly, the LDR seemed to have no impact on that. It connects to wifi and acts as an NTP client just fine.
It seems the LDR is wired to the ADC pin, analogRead(A0); works fine, giving 0-1023 readings.
The RGB LED pins seem to be red = GPIO15, green = GPIO12, blue = GPIO13. The red of the LED doesn’t seem to be PWM’ing, its either on or off.
The button is GPIO4 and is pulled HIGH, so when you press it, it reads LOW.
Anyway, here’s a sketch that reads from the LDR and writes to the LED, just to test its functionality:
const int LDR = A0;
const int BUTTON = 4;
const int RED = 15;
const int GREEN = 12;
const int BLUE = 13;
void setup()
{
Serial.begin(9600);
pinMode(LDR, INPUT);
pinMode(BUTTON, INPUT);
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
}
void loop()
{
Serial.print("LDR: ");
Serial.println(analogRead(LDR));
Serial.print("BUTTON: ");
Serial.println(digitalRead(BUTTON));
analogWrite(RED, random(0,1023));
analogWrite(GREEN, random(0,1023));
analogWrite(BLUE, random(0,1023));
delay(500);
}