These are chat archives for esp8266/Arduino

16th
Jun 2018
Chris Dalby
@moose4621
Jun 16 2018 00:08
@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
Jun 16 2018 00:27

@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
Jun 16 2018 02:15

@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
Jun 16 2018 02:39
@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
Jun 16 2018 10:39
@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
Jun 16 2018 10:42
@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
Jun 16 2018 10:51
@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
Jun 16 2018 10:55
@moose4621 PRESACTLY
Chris Dalby
@moose4621
Jun 16 2018 11:12
@denman0000_gitlab Is this any good to you?
den har
@denman0000_gitlab
Jun 16 2018 11:22
@moose4621 have seen that and been through it .. it doesn't quite show the simple thing I need .. He has some great tutorials though :-)
@moose4621 yes re printf ..where did you eventually find info ?
Chris Dalby
@moose4621
Jun 16 2018 11:24
den har
@denman0000_gitlab
Jun 16 2018 11:25
@moose4621 I was looking at your code and this part at the bottom .. String getContentType(String filename) { // determine the filetype of a given filename, based on the extension
if (filename.endsWith(".html")) return "text/html";
else if (filename.endsWith(".css")) return "text/css";
else if (filename.endsWith(".js")) return "application/javascript";
else if (filename.endsWith(".ico")) return "image/x-icon";
else if (filename.endsWith(".gz")) return "application/x-gzip";
else if (filename.endsWith(".gif")) return "image/gif";
else if (filename.endsWith(".png")) return "image/png";
else if (filename.endsWith(".mp3")) return "audio/mpeg mp3";
return "text/plain";
}
@moose4621 that block of code .. is it there for when a particular file with a specific extension is 'allowed/exposed/made available' ?
@moose4621 I eventually used this : server.serveStatic("/f.txt", SPIFFS, "/f.txt");
Chris Dalby
@moose4621
Jun 16 2018 11:27
Yes.
You are creating/editing a txt file?
den har
@denman0000_gitlab
Jun 16 2018 11:28
@moose4621 awesome then I'll pop that in .. in fact maybe I should just copy and paste that example that you used and hack that one
I just don't have an RGB LED around and will only be able to get one on Monday
Chris Dalby
@moose4621
Jun 16 2018 11:29
@denman0000_gitlab That's a good start because it works straight out of the box. Not like most examples I tried.
@denman0000_gitlab Just use 3 leds instead.
Ash
@ashthespy
Jun 16 2018 12:48
@moose4621 if you need floating point - then use floating point? I don't think you are reaching the memory limits of the ESP with your current setup!
https://jeelabs.org/book/1506d/ has some nice basics
den har
@denman0000_gitlab
Jun 16 2018 12:56
@moose4621 will try it :-) thank you
@ashthespy hi ash how you ?
Chris Dalby
@moose4621
Jun 16 2018 14:26
%
Chris Dalby
@moose4621
Jun 16 2018 14:52
@denman0000_gitlab you are only interested in the Communication so just print it to serial.
Bert Melis
@bertmelis
Jun 16 2018 15:00
Someone here that has some experience with searching for memory leak?
I've got a smalle DHT library (interrupties driven) but I'm losing 40-80 bytes on every read cycle.
(sigh, autocorrect)
Bert Melis
@bertmelis
Jun 16 2018 16:44
void attachInterrupt(uint8_t pin, std::function<void(void)> intRoutine, int mode)
{
    // use the local interrupt routine which takes the ArgStructure as argument
    __attachInterruptArg (pin, (voidFuncPtr)interruptFunctional, new ArgStructure{intRoutine}, mode);
}
Does this create a memleak every time you attach a functional interrupt handler?
where does this new ArgStructure gets deleted?
@hreintke
Bert Melis
@bertmelis
Jun 16 2018 18:12
created issue esp8266/Arduino#4817
Stavros Korokithakis
@skorokithakis
Jun 16 2018 20:44
hello
but this is for 5V, and my Vcc is 3.3V, how can I adapt it? I'm not sure what happens there, looks like a voltage divider?
oh sorry, no, my Vcc is indeed 5V... i'm not sure why that doesn't work, hmm
my logic is 3.3V
the "RX Serial" part
Chris Dalby
@moose4621
Jun 16 2018 20:49
@skorokithakis What transistor are you using?
Stavros Korokithakis
@skorokithakis
Jun 16 2018 20:55
@moose4621 great question, let me check
BC 337-25
Chris Dalby
@moose4621
Jun 16 2018 21:01
Hmm, maybe a pull down resistor on the Tx SBUS line. What is the voltage at Tx SBUS when LOW?
Stavros Korokithakis
@skorokithakis
Jun 16 2018 21:03
@moose4621 good question, I think 5v, it's a 5V receiver
so I guess 5V logic
Stavros Korokithakis
@skorokithakis
Jun 16 2018 21:08
looks like i need to move that RX resistor between RX and GND
to get 3.3V
assuming the transistor is fine with 5V
Chris Dalby
@moose4621
Jun 16 2018 21:10
You still need a resistor to limit the current to the base though.
@moose4621 good question, I think 5v, it's a 5V receiver That's when it is high, what is it when it is low?
Stavros Korokithakis
@skorokithakis
Jun 16 2018 21:12
oh hmm
looks like it's 0 when it's low
that inverter schematic was for my specific controller and an Arduino, so it should work
i just need to translate the voltages, presumably, because it won't work now
Stavros Korokithakis
@skorokithakis
Jun 16 2018 21:18
well, it works better now, in that it's reading data, except the data is not correct. hmm...
Stavros Korokithakis
@skorokithakis
Jun 16 2018 21:25
shiiiiiiiiiiiiiiit, it works!
wow
Chris Dalby
@moose4621
Jun 16 2018 21:26
@skorokithakis Congrats. :-)
Stavros Korokithakis
@skorokithakis
Jun 16 2018 21:27
thanks @moose4621!
maybe I should make a PCB for this
den har
@denman0000_gitlab
Jun 16 2018 21:58
@moose4621 Hi how are you today ? Whats new's? Just wanted to know which previous comment this reply of yours was relating to ?
den har
@denman0000_gitlab
Jun 16 2018 22:49
@skorokithakis Hi there .. how are you ?
Stavros Korokithakis
@skorokithakis
Jun 16 2018 23:05
@denman0000_gitlab i am well, how about you?