These are chat archives for esp8266/Arduino

14th
Jun 2018
den har
@denman0000_gitlab
Jun 14 2018 00:43
Hi All
Does any kind soul here have a simple clear and working example of how to append to a file in SPIFFS ?
den har
@denman0000_gitlab
Jun 14 2018 00:49
@ashthespy Hi Ash .. how are you today ?
@moose4621 Hi moose how are you today ?
I am able to create a new file in SPIFFS but how to append and then list the contents ?
den har
@denman0000_gitlab
Jun 14 2018 01:02
BUMP
:-)
den har
@denman0000_gitlab
Jun 14 2018 01:12
I'm trying this example and even using append option a+ file just keeps getting overwritten and only ever has 10 entries https://www.esp8266.com/viewtopic.php?f=29&t=8194&start=12
den har
@denman0000_gitlab
Jun 14 2018 01:32
nevermind :-) found a solution
Chris Dalby
@moose4621
Jun 14 2018 09:12
@ashthespy I'm feeling like a real dumb ass at the moment.I just cannot seem to get a grip on this. Thank you for your example but I still don't understand what is happening.
This is where I at at currently on the server. void sendSettings()
{
uint16_t data[] = {setpointVariable, targetGroundSpeed};
// payload[0] = setpointVariable;
// payload[1] = targetGroundSpeed;
const uint8_t payload = ((uint8_t *)data, 4);
webSocket.broadcastBIN(payload, sizeof(payload));
}
Which does not compile.
error: call of overloaded 'broadcastBIN(const uint8_t&, unsigned int)' is ambiguous
But I am poking around in the dark since I don't understand what is going on anyway.
Chris Dalby
@moose4621
Jun 14 2018 20:22
@ashthespy Using this code:
void sendSettings()
{
uint16_t data[] = {setpointVariable, targetGroundSpeed};
uint8_t payload = ((uint8_t *)data, 4);
webSocket.broadcastBIN(payload, sizeof(payload));
}
I get this error:
error: call of overloaded 'broadcastBIN(uint8_t&, unsigned int)' is ambiguous
note: no known conversion for argument 1 from 'uint8_t {aka unsigned char}' to 'uint8_t {aka unsigned char}'
note: bool WebSocketsServer::broadcastBIN(const uint8_t, size_t) <near match>
bool broadcastBIN(const uint8_t
payload, size_t length);
den har
@denman0000_gitlab
Jun 14 2018 20:49
Hi all anyone here ?
Chris Dalby
@moose4621
Jun 14 2018 20:50
Just me.
How did you go with your project?
den har
@denman0000_gitlab
Jun 14 2018 20:50
@ashthespy @moose4621 I wonder if you could please explain something I am battling with.
I have a web page containing a table with buttons to add or delete rows etc.
I would like to be able to read the table data (into an VAR/array or directly from a file in SPIFFS)
Do you know how to share the VAR/array so that I can access it from both the webpage (HTML/javascript/jquery) and the serial console (esp arduino side) ?
Are variable shared and accessible between the two ? For example if I have String WORDS=ABC; in my arduino code then will that data be accessible from the webpage (HTML side) ?
I would really appreciate if you could clarify this and maybye post an example of if you know of a URL somewhere as a reference ..I have been looking for a few weeks now to understand this.
@moose4621 COOL :-)
its going good so far I have success writing to and appending to a file in SPIFFS
how's yours going ?
I didnt even ask what you're busy with .. how rude of me :( sorry
íf you'd like to share a little perhaps i could also help
Chris Dalby
@moose4621
Jun 14 2018 20:52
I am currently stuck trying to send an int array over a uint8 websocket.
I have in the mean time implemented eeprom to store settings between bootups.
den har
@denman0000_gitlab
Jun 14 2018 20:54
thats cool re setting re eeprom and bootup
Chris Dalby
@moose4621
Jun 14 2018 20:55
I am controlling a stepper motor driven agricultural machine via Wemos D1 mini, (esp8266) and websockets to a remote device.
den har
@denman0000_gitlab
Jun 14 2018 20:55
could you switch int array to uint8 on one side and then switch it on the other
i has a similar issue in arduino some years back
cool is it dont via a webpage moose ?
Chris Dalby
@moose4621
Jun 14 2018 20:56
I seem to be unable to comprehend what needs to be done.
den har
@denman0000_gitlab
Jun 14 2018 20:56
i found drawing the stuff first help s a lot
can you send pics here ?
Chris Dalby
@moose4621
Jun 14 2018 20:56
Yes, via html and js.
den har
@denman0000_gitlab
Jun 14 2018 20:56
i mean can one send pics on here ?
cool then have a look back at my issue .. and see if you could help me too :-)
Chris Dalby
@moose4621
Jun 14 2018 20:57
Ash has posted pics so I guess so.
den har
@denman0000_gitlab
Jun 14 2018 20:57
lets draw the problem part of yours in block diagram
do you know how to add a pic here?
Chris Dalby
@moose4621
Jun 14 2018 20:58
Ash gave me more time than I am worth to create this example. https://repl.it/repls/PersonalQuixoticDowngrade
den har
@denman0000_gitlab
Jun 14 2018 20:59
thats hectic code for me lol
its the notation :-)
Chris Dalby
@moose4621
Jun 14 2018 21:00
I cannot make heads or tails of it.
The client sends data to the server, the server then writes the data to eeprom and broadcasts the data back to all clients. The data has a maximum value of 300.
void sendSettings()
{
uint16_t data[] = {setpointVariable, targetGroundSpeed};
uint8_t payload = ((uint8_t *)data, 4);
webSocket.broadcastBIN(payload, sizeof(payload));
}
den har
@denman0000_gitlab
Jun 14 2018 21:03
assuming this is the case :
int x = 3;
uint8_t y = x;
thats the simple start right ?
Chris Dalby
@moose4621
Jun 14 2018 21:06
The size of (payload) seems to be a problem.
note: bool WebSocketsServer::broadcastBIN(uint8_t, size_t, bool) <near match>
bool broadcastBIN(uint8_t
payload, size_t length, bool headerToPayload = false);
den har
@denman0000_gitlab
Jun 14 2018 21:08
@moose4621 maybe reference this one :
https://jeelabs.org/book/1506d/
Is the array being nulled ?
Chris Dalby
@moose4621
Jun 14 2018 21:10
?? nulled?
den har
@denman0000_gitlab
Jun 14 2018 21:11
@moose4621 have you possible posted the question on the arduino forums ? and then wait for a little flack and get through the sarcy comments .. I believe someone like PaulS or one of the other regulars there might be able to shed light on the problem
ok let me ask you a question .. are you used to dealing with arrays and structs ?
Chris Dalby
@moose4621
Jun 14 2018 21:13
I sought of cracked the .....ts with the arduino forum. Too much negativity. Unfriendly people.
den har
@denman0000_gitlab
Jun 14 2018 21:13
@moose4621 if not then I would suggest go right back to basics and understand how the array works in c++ and arduino
Chris Dalby
@moose4621
Jun 14 2018 21:13
I am ok with arrays.
den har
@denman0000_gitlab
Jun 14 2018 21:13
@moose4621 I totally underatnd .. was in same mindset for many a year and feel the same re arduino forums
Chris Dalby
@moose4621
Jun 14 2018 21:14
I am not ok with uint type defs and syntax around the payload stuff.
den har
@denman0000_gitlab
Jun 14 2018 21:14
cool re arrays .. .. cos maybe you need to something as simple as examining the array since thats probably handling the payload and that me well be too full ?
@moose4621 I too have been at the same dark place re that lot
Chris Dalby
@moose4621
Jun 14 2018 21:15
I have had it working as a uint8-t fine but of course it only goes to 255.
I need to cast to a uint16 to get to 300.
den har
@denman0000_gitlab
Jun 14 2018 21:16
what about using characters instead
Chris Dalby
@moose4621
Jun 14 2018 21:17
But websockets only lets you transmit BIN in uint8.
den har
@denman0000_gitlab
Jun 14 2018 21:17
and a number of characters
have you posted on stackoverflow yet ?
Chris Dalby
@moose4621
Jun 14 2018 21:18
I joined, asked a question, waited, waited, waited, then left.
den har
@denman0000_gitlab
Jun 14 2018 21:19
@moose gonna just post this in general here quick in meantime
I wonder if someone could please explain something I am battling with.
I have a web page containing a table with buttons to add or delete rows etc.
I would like to be able to read the table data (into an VAR/array or directly from a file in SPIFFS)
Do you know how to share the VAR/array so that I can access it from both the webpage (HTML/javascript/jquery) and the serial console (esp arduino side) ?
Are variable shared and accessible between the two ? For example if I have String WORDS=ABC; in my arduino code then will that data be accessible from the webpage (HTML side) ?
I would really appreciate if you could clarify this and maybye post an example of if you know of a URL somewhere as a reference ..I have been looking for a few weeks now to understand this.
den har
@denman0000_gitlab
Jun 14 2018 21:20
@moose4621 I must apologize in advance for my limited knowledge re c coding .. but happy to try help and research to assist
Chris Dalby
@moose4621
Jun 14 2018 21:20
I value your time and effort @denman0000_gitlab Thanks you.
den har
@denman0000_gitlab
Jun 14 2018 21:20
@moose haha i see you also used NRF ;-) thats cool .. common ground :-)
@moose4621 haha i see you also used NRF ;-) thats cool .. common ground :-)
_
Chris Dalby
@moose4621
Jun 14 2018 21:21
I thought they were great untill esp came along.
den har
@denman0000_gitlab
Jun 14 2018 21:21
@moose4621 indeed .. just the range was sad :-(
Chris Dalby
@moose4621
Jun 14 2018 21:21
The eeprom script is the latest.
den har
@denman0000_gitlab
Jun 14 2018 21:22
@moose4621 that EEPROM script sounds so interesting too especially to hold a unique ID number especially in a one to many broadcast scene single TX and multiple RX
@moose4621 ..that how my whole home system was working
@moose4621 left the NRF stuff in the middle of building a relay transmit protocol for when some NRF's were out of range and coudnt be reached
Chris Dalby
@moose4621
Jun 14 2018 21:24
@denman0000_gitlab It's a handy feature. In my case the opreator can carry on where he left off after reboot.
den har
@denman0000_gitlab
Jun 14 2018 21:25
@moose4621 I am currently trying to build my whole control frontend in a webpage as oppsed to serial input like it used to be
@moose4621 INDEED re carry on after
Chris Dalby
@moose4621
Jun 14 2018 21:25
Cool relayed NRF's. Of course you can easily do the same with esp too.
den har
@denman0000_gitlab
Jun 14 2018 21:25
I'm sure SPIFFS would work nicely for you
Chris Dalby
@moose4621
Jun 14 2018 21:26
It does. Great.
den har
@denman0000_gitlab
Jun 14 2018 21:26
@moose4621 .. will delve into that once this web frontend is complete .. after im done with it it will serve as a connect any radio or end point to it
@moose so you came right with spiffs too ?
@moose4621 I am currently able to append to the file in spiffs
@moose4621 and the data is available after rebbot which is cool too
Chris Dalby
@moose4621
Jun 14 2018 21:28
Yep, see data directory in my project. all files are external to arduino sketch and served via spiffs.
den har
@denman0000_gitlab
Jun 14 2018 21:28
@moose4621 looking now
@moose4621 wow and audio too :-)
@moose4621 nice one
Chris Dalby
@moose4621
Jun 14 2018 21:29
Yeah, a warning ding dong for low gps hdop.
I am so close to finished now. Just need to solve this data brodcast issue and it's finished.
@denman0000_gitlab Until I think of something new.
den har
@denman0000_gitlab
Jun 14 2018 21:34
@moose4621 WOW looks like you've done a lot of work ... Well done
@moose4621 what about having two u_int8 packets/sends
@moose4621 for example u_int8 first_one1 then example u_int8 second_one
@moose4621 so you end up with a mapping 1:1 1:2 etc etc etc
Chris Dalby
@moose4621
Jun 14 2018 21:36
But I can still only send bytes of 255< ??
den har
@denman0000_gitlab
Jun 14 2018 21:36
@moose4621 yes agreed but
@moose4621 if array value [0] is 1
@moose4621 and array value [1] is 1
Chris Dalby
@moose4621
Jun 14 2018 21:38
I see where you are going.
den har
@denman0000_gitlab
Jun 14 2018 21:40
you can use those combined .. one the tx side you have 1: 1 or 1:2 then split that into array value [0]1 and array value [1]1 send that using the u_int 8 array to the RX who then takes array value [0]1 and array value [1]1 to assemble 1:1
@moose4621 so now you have plenty number combos
Chris Dalby
@moose4621
Jun 14 2018 21:41
([0]100)+( [1]10)+ [2]
den har
@denman0000_gitlab
Jun 14 2018 21:41
@moose4621 1:1 , 1:2 , 1:3 or 2:1, 2:2 etc etc
smashing thats it
combinations are huge then :-)
@moose4621 255 to the power of 255 ?
or is it 255 squared ?
@moose4621 lol
Chris Dalby
@moose4621
Jun 14 2018 21:42
Yep, should work.
den har
@denman0000_gitlab
Jun 14 2018 21:42
@moose4621 i thinks it's a simple work around
Chris Dalby
@moose4621
Jun 14 2018 21:42
Def 255^255
den har
@denman0000_gitlab
Jun 14 2018 21:43
@moose4621 and actually you'll end up with many more possibilities and you could get ultra granualr
@moose4621 :-)
Chris Dalby
@moose4621
Jun 14 2018 21:43
S
den har
@denman0000_gitlab
Jun 14 2018 21:43
@moose4621 then you dont have the same headache anymore ;-)
Chris Dalby
@moose4621
Jun 14 2018 21:44
@denman0000_gitlab Sounds like a plan I can inplement with my level of knowledge.
Awesome thanks @denman0000_gitlab
den har
@denman0000_gitlab
Jun 14 2018 21:44
@moose4621 Presactly .. you're back in your comfy space
@moose4621 My pleasure .. hope its a huge success and I'm sure you'll make it work well since the concept seems a little easier
@moose4621 and actually its like a tuning and fine tuning knob on an older radio :-)
Chris Dalby
@moose4621
Jun 14 2018 21:46
Got to go to work soon but I have renewed vigor for tonights homework. :-)
@denman0000_gitlab Thanks for your time den har. Much appreciated.
den har
@denman0000_gitlab
Jun 14 2018 21:48
@moose4621 AWESOME ...yaaaaaaaaay .. what timezone you in ?
Chris Dalby
@moose4621
Jun 14 2018 21:49
Next modification somewhere down the track, write gps track to spiffs kml file to record what areas have been seeded.
GMT+10
Australia.
den har
@denman0000_gitlab
Jun 14 2018 21:50
@moose4621 if you have a gap sometime and up for it I would love to ask you a few questions like the one i posted here .. I just need to grab table data and read and write itto a file in spiffs or even SD
@moose4621 AAAH I'm in Johannesburg South Africa
Chris Dalby
@moose4621
Jun 14 2018 21:51
Wow ok, what time zone?
den har
@denman0000_gitlab
Jun 14 2018 21:51
@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
Jun 14 2018 21:55
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