Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: Update Teensy 3.2 Sketch Variables Remotely

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    7

    Update Teensy 3.2 Sketch Variables Remotely

    Hey All,

    I have been mucking around with a project for the last few months and now have the basics working.

    Now i am looking for a way to update variables that a sketch will look at. But i would like to use a GUI for web page based UI to amend the "settings" (variables) for a user friendly experience.

    I have looked around the Internet quite a lot, but haven't really had much success.

    If anyone would have some suggestions that would be great.

    Regards,

    Edd

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,481
    How is your Teensy 3.2 getting internet/remote connectivity? WIZ820? USB to a PC? Something else?

    Without a clear picture of how your project works, what it actually does, and how it connects, how can anyone hope to make any relevant suggestions?

  3. #3
    Member
    Join Date
    Nov 2015
    Location
    Cold hollow VT
    Posts
    73
    Have not gotten into the internet update aspect, but, have used SerialEvent to input data strings and parse them to extract variable values, do a calculation and return an answer to a remote serial terminal. Check out the example given. it is fairly easy to modify for other uses and for other serial inputs (Serial1, Serial2, etc.)

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,378
    With the added info - perhaps something like an ESP8266 would do the job?

    It can sit on WiFi and present a web interface and then serial can be used to transfer data on and off between the Teensy and the web page.

    It can be setup and programmed under Arduino as well. I had a seemingly workable start some 2 years back : ArduinoTeensyESP8266

  5. #5
    Junior Member
    Join Date
    Dec 2017
    Posts
    7
    Hey,

    Thanks for the reply's

    I am making a LED WS2812B strip controller where i am using USB and JINX to control the strip's. I would like to be able to change the LED string length variable via a UI, preferably IP based web page, but could be a LCD screen and buttons.

    Edd

  6. #6
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    277
    ArduinoJson works well if you'd like to use JSON formatted strings for configuring your software. You'd still have to figure out a method for sending those strings, but it can help with the serialization and de-serialization aspect. I'm not affiliated with the library, but I'm using it on a few projects over I2C and serial with Teensy devices and it works well. Might be a bit overkill for just changing 1 parameter though.

    https://github.com/bblanchon/ArduinoJson

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,378
    Some LED length variables are built in at compile time. Though it seems you might declare for MAX length and then address a shorter length when desired.

  8. #8
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,378
    The link of mine uses a linked 'myWebServer ' that uses the same JSON code - Looking now he has published an updated https://github.com/nailbuster/myWebServerAsync that I have not looked at - but the earlier code was very good as I saw it.

  9. #9
    Junior Member
    Join Date
    Dec 2017
    Posts
    7
    So am i right in thinking i need to attach an ethernet sheild to the teensy and then look into a Web base UI?

  10. #10
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,592
    Or you attach a touch LCD display. If you don't want to put a lot of CPU ressources in programming a GUI, an external HMI like the Nextion display might ease the task.

  11. #11
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,378
    Quote Originally Posted by eddcaton View Post
    So am i right in thinking i need to attach an ethernet sheild to the teensy and then look into a Web base UI?
    Indeed - no native Ethernet hardware support included with a Teensy - the ESP would do that with WiFi - or add on wired or other

  12. #12
    Junior Member
    Join Date
    Dec 2017
    Posts
    7
    I am going to try this Ethernet interface tomorrow, just trying to stray away from wifi if i can help it.
    http://www.epyon.be/2016/05/22/non-b...xample-teensy/

    Does anyone have a tutorial they could point me to for the web UI that i can change sketch variables with?

    Edd

  13. #13
    Junior Member
    Join Date
    Dec 2017
    Posts
    7
    Hey Not having much luck with the ethernet shield I currently have so I have bought a Wiz820io as this seems to be supported and documented a lot better than the ENC28J60 module I currently have.

    Does anyone have any tutorials on the Web interface that a user can connect to via the device IP, change and save variables?

    Any help would be much appreciated.

  14. #14
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,592
    Basically, it is about turning the Teensy into a web server which displays a web form where you can make entries, and which has a submit handler which processes your input to update the variables.

    It's not very different from coding any other html form.

  15. #15
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,446
    Quote Originally Posted by eddcaton View Post
    Hey Not having much luck with the ethernet shield I currently have so I have bought a Wiz820io as this seems to be supported and documented a lot better than the ENC28J60 module I currently have.

    Does anyone have any tutorials on the Web interface that a user can connect to via the device IP, change and save variables?

    Any help would be much appreciated.
    Using the wiz820io (or 850io) and the teensy Ethernet library, i would start with the library example WebServer. You can connect to that sketch with your browser, and it will read values from the ADC and send them back to your browser. From there you can expand the server to parse various GET requests and toggle the LED, or change or read various variables in your sketch.

    See https://github.com/manitou48/teensy3...ter/wizwww.ino

    Other options,
    WICED photon ($19) (web IDE) with cloud interface, smart-phone app Tinker to read/write your device ports, https://store.particle.io/collections/photon

    or apache/PHP etc. on Raspberry PI
    Last edited by manitou; 12-08-2017 at 06:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •