-
I need help to design the website(Seriously, it's terrible...please help)
03/14/2017 at 18:15 • 0 commentsHey, I was just reconsidering how ugly the website was, and I came up with this only solution. Ask for help. It costs me a lot actually. But yeah, whatever. If you're good with website design or just better than me (that's not hard, I can tell you), please mp me or leave a comment, I'll send you the files, or an html version of the files (the php can take a lot of space sometime).
Speaking of the website, I've started the contribute page, explaining how to create input types by yourself, to fit what you exactly need. I'll try to finish it by the week-end, and if I can't, at last for the middle of next week.
-
Device Feedback and Color Picker
03/12/2017 at 19:41 • 0 commentsOver the last few days, I worked on a few things. firstly, a color picker input type. It simply consists of three sliders, one by color. The value from the input is saved as 3 decimals bytes formatted in a string as "red;green;blue". An example file can be found in the files section.
The other interesting thing I worked on is the device feedback feature. It present itself as a simple input type on the website. However, for the device (arduino, raspberry or whatever...), there is a new possibility. By connecting to the page saveRemoteSingleValue.php with 4 get arguments, the device will save the provided value, and display it on the remote(it actualise once per second). Those arguments are :
- remoteId : the id of the remote
- password : the password of the remote
- input : the name of the input you want to change the value.
- value : the new value to assign to this input
The syntax for this is simple :
etienne-desrousseaux.com/e-duino/saveRemoteSingleValue.php?remoteId=remoteName&password=remotePassword&input=inputName&value=newValue
This feature can, for example, allow you to confirm that the device has received the order from the remote. You can find an example of this exact case in the files section.
However, take care of the spaces you might send in the value, since any space will modify the http request, and create a 400 error. To solve this, replace all spaces by '%20', which will be converted back by the php page(this is a php feature, I didn't changed it).
The next feature I want to develop is an input type explorer and a way for you to create input types.
If you think another feature should come first, just comment. If you find a bug, please do so too.
-
Open for you to test!!
03/08/2017 at 19:26 • 0 commentsHere we go!!!
You can from now on create a new remote here, using the code 'hackaday'. Right after creating the remote, you'll be able to add inputs to it. The actual possible inputs are :
-Text : a simple text input, nothing special here
-Switch : A simple button that you can turn on and off, still very basic
-Slider : A slider with a default range of [0; 255], which can be modified with two arguments :
-min: the minimum value
-max : the maximum value
The slider uses jquery ui.
The possibility for users to create some inputs is the next thing on my list, but if you need one quickly, feel free to ask.
Here's the arduino code to control some leds witha slider and/or a button. You can find it in the files section too.
/* * Code written by Etienne Desrousseaux as an example for the e-duino project : * https://hackaday.io/project/20088-e-duino * * written on 08/03/2017 * * * This example connects to a remote using an ethernet shield, downloads data from a slider and light up a led on pin 5, and to get the state of a button for a led on pin 3. * * Needed Component : * - 2 * led * - 2 * 220R * - Ethernet Shield * * Circuit : * * pin 3-------|>----{220R}---GND * pin 5-------|>----{220R}---GND * */ #include <SPI.h> #include <Ethernet.h> byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; char server[] = "www.etienne-desrousseaux.com";//the server where is the system for now IPAddress ip(192, 168, 0, 177); EthernetClient client; char answer[20]; void setup() { Serial.begin(9600);//debugging serial Serial.println("serial begun"); if (Ethernet.begin(mac) == 0) { Serial.println("error while connecting"); // try to congifure using IP address instead of DHCP: Ethernet.begin(mac, ip); } pinMode(3, OUTPUT); pinMode(5, OUTPUT); delay(10500);//leave a while for ethernet to connect, needed in my case to avoid a hell of "not connected" on serial later on Serial.println("connected..."); } void loop() { delay(250);//check value every 250 millis actualizeSwitch();//actualize the button, see at page bottom actualizeSlider();//actualize the slider, see next function } void actualizeSlider() { Serial.println("connecting..."); if (client.connect(server, 80)) //requests the value of the input named 'slider_test' of the 'test' remote { Serial.println("connected"); // Make a HTTP request: client.println("GET /e-duino/getRemoteValue.php?remoteId=test&input=slider_test HTTP/1.1"); client.println("Host: www.etienne-desrousseaux.com"); client.println("Connection: close"); client.println(); while(!client.available())//wait to get a result { delay(3); } } else//unable to connect { Serial.println("not connected"); if(client.connected()) { Serial.println("still connected"); } } //we received the content Serial.println("reading content..."); char endOfHeaders[] = "\r\n\r\n"; client.setTimeout(10000); bool ok = client.find(endOfHeaders);//trying to skip the header if(ok)//managed to skip the header { Serial.println("found content"); for(int i = 0; i < 3; i++)//for some reasons, there is 3 unwanted characters before the actual content, so we can just skip them { if(client.available()) { client.read(); } } byte b = 0;//how much should we light the led? for(byte i = 0; i < 3 && client.available(); i++)//maximum 3 digits (byte can only be between 0 and 255) { char c = client.read(); Serial.print(c); if(isDigit(c))//it is a digit, we add him to b { byte b2 = byte(c) - 48;//the char number for 0 is 48, for 1 is 49, and so on until 9, which is then 57 Serial.print(" - it is a digit - "); Serial.println(b2); b *= 10;//shift left the actual byte, eg: we receive 21 by client : first char : b = 0, b *= 10, b = 0, b += 2, b = 2; second char : b = 2, b *= 10, b = 20, b += 1, b = 21 b += b2; Serial.println(b); } else { i = 10; } } analogWrite(5, b); } else//the data is not in html format { Serial.println("bad format data received"); } client.stop(); } void actualizeSwitch() { Serial.println("connecting..."); if (client.connect(server, 80)) //requests the value of the input named 'switch_test' of the 'test' remote { Serial.println("connected"); // Make a HTTP request: client.println("GET /e-duino/getRemoteValue.php?remoteId=test&input=switch_test HTTP/1.1"); client.println("Host: www.etienne-desrousseaux.com"); client.println("Connection: close"); client.println(); while(!client.available()) { delay(3); } } else { Serial.println("not connected"); if(client.connected()) { Serial.println("still connected"); } } Serial.println("reading content..."); char endOfHeaders[] = "\r\n\r\n"; client.setTimeout(10000); bool ok = client.find(endOfHeaders);//skip html data if(ok) { Serial.println("found content"); for(int i = 0; i < 3; i++)//skip unwanted characters { if(client.available()) { client.read(); } } byte b = 0; char goal[] = "true"; while(client.available())//this system can be used for short strings too, since it test characters one by one. { char c = client.read(); Serial.println(c); if(c == goal[b]) { b++; if(b >= 4)//if 4 good characters, then the value starts with 'true', so we're good { break; } } else//wrong character, we return to 0 and stop there { b = 0; break; } } if(b > 0) { digitalWrite(3, HIGH); } else { digitalWrite(3, LOW); } } else//bad html signature { Serial.println("bad format data received"); } client.stop(); }
If you have any ideas that could improve the project, feel free to comment them :)
-
Remote Editor finished, moving on to database
03/07/2017 at 18:27 • 0 commentsFinally done with the remote editor, It is now possible to modify a remote from the website, having the website to write the json (see in gallery).
I started the database part, which will only contain the names and passwords of the remotes. It should be possible for anyone to create a remote by the end of the week.