in reply to Re: Global variables and SimpleHTTP request handler
in thread Global variables and SimpleHTTP request handler
Perhaps I should expand a little on what I'm trying to do. I tried to keep my original post down to the bare details.
For those who have not come across it, Scratch is a drag and drop programming language for kids. I'm trying to write an extension to it which can allow the control of Neopixels - programmable LEDs. The Scratch extension sends my custom command to a web server with all the parameters in a URL to a local web server. E.g. the scratch block tries to set pixel 2 with the RGB value 255,0,255 then the requested URL is:
/setneo/2/255/0/255The hardware itself is being driven by an Arduino which I'm communicating with over a serial cable. Scratch can send the requests faster than the arduino can process them so I need my request handler to place them in a queue which will then be sequentially processed.
At the moment the queue processor is just the while loop at the end of the example I give, so it is in the same package. Currently it is just reporting on how big the queue is, but once it can see data from request_handler then it will expand to do something more useful.
If a global variable can not be used, then I could look at using a file as a processing queue, but that sounds messy. Is there any other way to share data between two forked processes? A future expansion might be for Scratch to wait until the Arduino has processed a command or accept an input from the Arduino, so eventually I might be looking at a two way communication between the two bits of code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Global variables and SimpleHTTP request handler
by Corion (Patriarch) on Jan 03, 2017 at 14:56 UTC | |
by Anonymous Monk on Jan 03, 2017 at 21:39 UTC | |
|
Re^3: Global variables and SimpleHTTP request handler
by 1nickt (Canon) on Jan 03, 2017 at 15:17 UTC |