Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
den har
@denman0000_gitlab
@moose4621 AAAH I'm in Johannesburg South Africa
Chris Dalby
@moose4621
Wow ok, what time zone?
den har
@denman0000_gitlab
@moose4621 Fell free to hookup on skype .. milonelion
@moose4621 GMT +2
@moose4621 11:52 here
@moose4621 have a great day @ work today ..
Chris Dalby
@moose4621
I would gladly help you if I can especially given the parrallel between our projects.
Haven't used skype for years. We have had really sucky internet for so long and not been able to use it but we recently got upgraded so skype should be possible again.
Good night to you @denman0000_gitlab
Chris Dalby
@moose4621
@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
@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
@moose4621 your work around is on the right path - Google a bit(haha) about bit shifting
Chris Dalby
@moose4621
@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
void sendSettings()
{
  uint16_t data[] = {setpointVariable, targetGroundSpeed};
  uint8_t payload = (uint8_t *)data;
  webSocket.broadcastBIN(payload, sizeof(payload));
}
Ash
@ashthespy
Oh wait - you were trying to send decimal values?
den har
@denman0000_gitlab
@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
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

@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
@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
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
@ashthespy Hi Ash you here ?
Chris Dalby
@moose4621
@denman0000_gitlab
function senddata() { connection.send(var); }
Chris Dalby
@moose4621
@denman0000_gitlab You can distinguish between different strings by placing a character such as # at the start of the string.
case WStype_TEXT: // if new text data is received Serial.printf("[%u] get Text: %s\n", num, payload); if (payload[0] == '#') { // we get RPM data
den har
@denman0000_gitlab

@moose4621 cool Thnak you kindly ...I'll get to work on that .. I'm not using websockets by the way .. do you think I should change my code to the websockets way ? Currently I am using these libraries :

include <ESP8266WiFi.h>

include <WiFiClient.h>

//ESP Web Server Library to host a web page

include <ESP8266WebServer.h>

//SPIFFS LIBRARY

include <FS.h>

den har
@denman0000_gitlab

@moose4621 Just on a side note re NULL terminate and extra character in arrays in arduino http://learn.olympiacircuits.com/variables-and-arrays.html ...Arrays of char variables work a little differently:

char myMessage[] = “Hello World”;

This creates an array with 12 places. This might look wrong since there are only 11 characters in “Hello World”. Arduino creates an extra spot for a special character (called the null termination) that keeps track of where the array ends. This is helpful when we do things like sending the array to a computer screen.

@moose4621 which I was mentioning about the payload size issue which i thought it might be ...anyways i'm probably way off there :-)
Chris Dalby
@moose4621
@denman0000_gitlab H'mm not my field of expertise. Do you need instant reactions to inputs from either end? If so, wesockets is probably best since a direct connection is continuously open.
@denman0000_gitlab Why are you awake at 4am on a Saturday btw?
den har
@denman0000_gitlab
@moose4621 good day :-) thanks for the replies .. instant reactions not a requirement, does websockets have to listen on a dedicated port other than port 80 ? I was awake because was stuck on trying to find a solution for my little project :-( I wish it could just be a case of click click done. I find all of these chat spots are missing a crucial element ...voice .. the power of voice would be so much faster.
@moose4621 ...can this : function senddata() { connection.send(var); } be run without websockets ?
@moose4621 and finally would you happen to have a very simple example showing this : function senddata() { connection.send(var); }
Chris Dalby
@moose4621
@denman0000_gitlab I know what you mean. When you need an answer and you need it NOW! gets frustrating. Not sure if it works outside websockets. I'll have a look.
@moose4621 Indeed re answer or simple examples., some of these get so convoluted and then the nitty gritty and simple stuff are skipped over. Instead of just keeping it ultra simple they throw in so much extra that you lose the wood from the trees.They forget beginners and people need baby steps to move forward
Chris Dalby
@moose4621
@denman0000_gitlab I hear you on that. It took me hours to understand what printf("%#X\t" means. No explanations anywhere, it just magically appears in a example and you are expected to automatically know what it means.
den har
@denman0000_gitlab
@moose4621 PRESACTLY
Chris Dalby
@moose4621
@denman0000_gitlab Is this any good to you?
den har
@denman0000_gitlab
@moose4621 have seen that and been through it .. it doesn't quite show the simple thing I need .. He has some great tutorials though :-)