These are chat archives for esp8266/Arduino

15th
Jun 2018
Chris Dalby
@moose4621
Jun 15 2018 01:35
@denman0000_gitlab @ashthespy Super simple solution to my problem in language even I can understand. For once I am thankful for truncated int :-)
void sendSettings()
{
int setpointVariable100 = setpointVariable / 10;
int setpointVariable10 = setpointVariable - (setpointVariable100 10);
int targetGroundSpeed100 = targetGroundSpeed / 10;
int targetGroundSpeed10 = targetGroundSpeed - (targetGroundSpeed100
10);
uint8_t payload[4] = {0, 0, 0, 0};
payload[0] = setpointVariable100;
payload[1] = setpointVariable10;
payload[2] = targetGroundSpeed100;
payload[3] = targetGroundSpeed10;
webSocket.broadcastBIN(payload, sizeof(payload));
}
Client side:
var e=document.getElementById("R").value=buffer[0]+(buffer[1]/10);
var e=document.getElementById("G").value=buffer[2]+(buffer[3]/10);
Thank you both so much for your help. Sooo much appreciated.
Chris Dalby
@moose4621
Jun 15 2018 08:30
@denman0000_gitlab gonna just post this in general here quick in meantime It sounds like what I am doing in my sketch. text messages and data are being accessed from each end and being updated on the other simultaneously.
Ash
@ashthespy
Jun 15 2018 10:49
@moose4621 your work around is on the right path - Google a bit(haha) about bit shifting
Chris Dalby
@moose4621
Jun 15 2018 10:56
@ashthespy I learnt the lesson about integer math and arduino and will never forget it ;-) I alway convert to whole number now before doing anything.
Ash
@ashthespy
Jun 15 2018 11:34
void sendSettings()
{
  uint16_t data[] = {setpointVariable, targetGroundSpeed};
  uint8_t payload = (uint8_t *)data;
  webSocket.broadcastBIN(payload, sizeof(payload));
}
Ash
@ashthespy
Jun 15 2018 12:19
Oh wait - you were trying to send decimal values?
den har
@denman0000_gitlab
Jun 15 2018 21:15
@ashthespy Howdy ash man :-)
@moose4621 hey Moose .. yay di you come right ? :-) So glad man .. knew you could do it ..wooohooooo
Hi all :-)
Chris Dalby
@moose4621
Jun 15 2018 21:50
Hi @denman0000_gitlab Yes the world is at peace again. All breath a sigh of relief ;-)
@ashthespy No decimals, I convert to whole numbers before hand and do everything I need to do with whole numbers then convert back to decimals for display.
Chris Dalby
@moose4621
Jun 15 2018 22:15

@ashthespy

void sendSettings()
{
  uint16_t data[] = {setpointVariable, targetGroundSpeed};
  uint8_t payload = (uint8_t *)data;
  webSocket.broadcastBIN(payload, sizeof(payload));
}

error: invalid conversion from 'uint8_t {aka unsigned char}' to 'uint8_t {aka unsigned char}' [-fpermissive]
uint8_t payload = (uint8_t *)data;

den har
@denman0000_gitlab
Jun 15 2018 23:08
@moose4621 thats really awesome :-) yay
@moose4621 I have now managed to build a table from csv file (still have to do the reverse
@moose4621 do you know how to handle the variables ...lets say i create a VAR to hold the date in javascript as a string ... how do i make that available to esp8266 arduino environement ( I used to collect tthe date via serial.read or serial to string
den har
@denman0000_gitlab
Jun 15 2018 23:16
so i would capture the current date via html inputbox submit , then capture it in a VAR in javascript .. how do i get to use that ? It may be a simple thing but just can't get my head around it ?
@moose4621 so i would capture the current date via html inputbox submit , then capture it in a VAR in javascript .. how do i get to use that ? It may be a simple thing but just can't get my head around it ?
den har
@denman0000_gitlab
Jun 15 2018 23:22
@ashthespy Hi Ash you here ?
Chris Dalby
@moose4621
Jun 15 2018 23:57
@denman0000_gitlab
function senddata() { connection.send(var); }