Advertisement
Guest User

arduino

a guest
Jan 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. #define PROX_0 D0
  2. #define PROX_1 D5
  3. #define PROX_2 D6
  4. #define PROX_3 D7
  5.  
  6. #include <ESP8266WiFi.h>
  7. #include <BlynkSimpleEsp8266.h>
  8.  
  9. unsigned long t = 0;
  10. const int analogPin = A0;
  11.  
  12. char auth[] = "f0fad43aa88e471ebb9d175582375937";
  13. // Your WiFi credentials.
  14. // Set password to "" for open networks.
  15. char ssid[] = "williwechseltniedasklopapier";
  16. char pass[] = "32e41f3611";
  17.  
  18. BlynkTimer timer;
  19. int serialInput;
  20. // This function sends Arduino's up time every second to Virtual Pin (5).
  21. // In the app, Widget's reading frequency should be set to PUSH. This means
  22. // that you define how often to send data to Blynk App.
  23. void myTimerEvent()
  24. {
  25. // You can send any value at any time.
  26. // Please don't send more that 10 values per second.
  27. Blynk.virtualWrite(V5, millis() / 1000);
  28. }
  29.  
  30. void setup()
  31. {
  32. pinMode(PROX_0, INPUT);
  33. pinMode(PROX_1, INPUT);
  34. pinMode(PROX_2, INPUT);
  35. pinMode(PROX_3, INPUT);
  36.  
  37. // Debug console
  38. Serial.begin(74880);
  39. Serial.print(""); // first character is wrong encoding
  40. //Serial.println("waiting 5s");
  41. //delay(5000);
  42.  
  43. Serial.println("startup wifi");
  44. //Blynk.begin(auth, ssid, pass);
  45. //timer.setInterval(1000L, myTimerEvent);
  46. }
  47.  
  48.  
  49. void loop()
  50. {
  51. //Blynk.run();
  52. //timer.run();
  53.  
  54. //Read analog pin instead of loadCellLoop
  55. int val = 1000 * digitalRead(PROX_0) +
  56. 100 * digitalRead(PROX_1) +
  57. 10 * digitalRead(PROX_2) +
  58. digitalRead(PROX_3);
  59.  
  60. Serial.println(val);
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement