mirror of
https://github.com/0x1d/esp8266-laser.git
synced 2025-12-15 18:38:20 +01:00
added primitive read of laser return (poc for future preset feature)
This commit is contained in:
@@ -325,6 +325,7 @@ boolean setupWifi() {
|
||||
|
||||
void setup(void) {
|
||||
laserSerial.begin(9600);
|
||||
laserSerial.flush();
|
||||
Serial.begin(115200);
|
||||
Serial.print("\n");
|
||||
SPIFFS.begin();
|
||||
@@ -427,6 +428,29 @@ void handleNotFound() {
|
||||
|
||||
void loop(void) {
|
||||
server.handleClient();
|
||||
|
||||
|
||||
int i = 0;
|
||||
char commandbuffer[100];
|
||||
String sBuffer;
|
||||
|
||||
if (laserSerial.available()) {
|
||||
delay(100);
|
||||
|
||||
while ( laserSerial.available() && i < 99) {
|
||||
commandbuffer[i] = laserSerial.read();
|
||||
i++;
|
||||
}
|
||||
commandbuffer[i++] = '\0';
|
||||
}
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
delay(200);
|
||||
Serial.print("received from laser: ");
|
||||
Serial.println((char*)commandbuffer);
|
||||
// Serial.println(()sBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user