iot_esp8266_cloud_test.ino 939 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * esp8266 CLOUD version chip
  3. * (with light sensor and LED light at the two corners)
  4. *
  5. *
  6. * gpio2 - small power/status led
  7. * a0 - analog read
  8. *
  9. *
  10. * RGB LED pin - not 4, 5, 0
  11. *
  12. * pin 15 is RED
  13. */
  14. #include <ESP8266WiFi.h>
  15. const char* ssid = "hazard18";
  16. const char* password = "pu1f0xylu1";
  17. const char* host = "wifitest.adafruit.com";
  18. void setup() {
  19. pinMode(15, OUTPUT);
  20. pinMode(2, OUTPUT);
  21. pinMode(A0, INPUT);
  22. Serial.begin(115200);
  23. delay(100);
  24. Serial.print("Starting... ");
  25. }
  26. int a0;
  27. void loop() {
  28. /* Serial.println("set 4 high");
  29. digitalWrite(4, HIGH);
  30. delay(1500);
  31. Serial.println("set 4 low");
  32. digitalWrite(4, LOW);
  33. delay(1000);
  34. */
  35. Serial.println("set 5 high");
  36. digitalWrite(15, HIGH);
  37. delay(500);
  38. Serial.println("set 5 low");
  39. digitalWrite(15, LOW);
  40. delay(500);
  41. a0= (unsigned int) analogRead(A0);
  42. Serial.println("a0 val: " + String(a0));
  43. }