-
Data Logging All Night Long
05/18/2016 at 06:31 • 0 commentsUpdate period 30 sec.
That's all folks.
-
Functions
05/17/2016 at 16:51 • 0 comments- Pressing switch must update ThingSpeak so use interrupts. Blues switch on Nucleo
- Create function and link with timer-tick to read all sensors.
Initial plan was to update data each second but with DS1820 and MS5803 it isn't possible because reading peripheral over different I2C is to slow so I changed update time to 3 seconds.
Ticker flipper;
InterruptIn mybutton(USER_BUTTON);
while(1){ ... }
-
Adding WiFi
05/17/2016 at 16:40 • 0 commentsESP8266 is used to update ThingSpeak.
Sample of code to test is ESP is connected and have correct IP adrress.
Serial esp(PA_11,PA_12); esp.baud(115200); // Resetuj WiFi modul pc.printf("\nReset ESP8266\n"); esp.printf("AT+RST\r\n"); esp_read(); wait(1); pc.printf(esp_str); // Povezi se na AP pc.printf("\nConnecting to AP"); strcpy(povezi_ap, "AT+CWJAP=\""); strcat(povezi_ap, ssid); strcat(povezi_ap, "\",\""); strcat(povezi_ap, pwd); strcat(povezi_ap, "\"\r\n"); esp.printf(povezi_ap); esp_read(); pc.printf(esp_str); wait(1); // Povezi se na AP pc.printf("\nIP"); esp.printf("AT+CIFSR\r\n"); esp_read(); pc.printf(esp_str); // Proveri da li se WiFi modul povezao i dobio IP adresu char *datax; datax=strstr(esp_str, "192."); //pc.printf("\nPointer %i",*datax); if (strcmp(datax,"0" )<=0){ sound=sound_period; wait(1); sound=0; myLcd.SetXY(char(1),char(1)); myLcd.DrawString(" ERROR NO IP"); } else{ myLcd.SetXY(char(1),char(1)); myLcd.DrawString(" CONECTED"); }