SaveSandy.org


My sister in-law Sandy Phan-Gillis has been detained in China by the China Ministry of State Security since March 19, 2015, and is being investigated on charges of Spying and Stealing State Secrets. Sandy is not a spy or a thief. Representatives of the Chinese Foreign Ministry have admitted as much. The purpose of this site is to provide information about Sandy and her case, and to help free her from her detention in China. This site is also meant to be a call to action, and suggests steps that you can take to help. http://www.savesandy.org/

New Lenovo S898t Golden Warrior


I purchased a Lenovo s898t "Golden Warrior" phone from Pandawill.com. The phone was shipped from China and it took a couple of weeks to arrive. This is a Andriod Kitkat 4.2.2 phone. I will be adding additional information to this article as I discover it. I will also add some photos and screen shot as time allows. Lenovo is the third largest phone manufacturer since they bought the Motorola handset division from Google earlier this year. To turn on USB Debugging just plug in a USB cable from your PC to the phone. You will see the USB PC Connection screen on the phone and USB debugging is an option. Developer options are hidden. To enable go to settings -> About device -> Device information. Click on the build number and the phone will tell you that you are 4 steps away from becoming a developer. Click the build number several more times until it says you are now a developer. So back to the settings and the development options are now shown. There are only three options for developer options. USB Debugging, Stay awake and Allow mock locations.

Arduino Project


 

I started this Arduino project with the objective to be able to login to an ethernet server on my home network and turn a computers power on and off. I have an old server that I seldom need and I don't want to leave running all of the time but when I do need it I want to be able to remotely power it up. I also run this website from a server on my network and it occasionally hangs and needs to be powered down and back up. This project, when complete will allow me to control up to four devices. I did my testing with a relay board but I will switch to solid state switches to do the actual power switching. Once I have completed the packaging I will post another article documenting what I did.

Below is the Arduino/Webduino code.

I tested it in Chrome and it worked fine. When I tried it in IE9 I had an issue where IE set the Document Mode to quirks. When I set it to IE9 standards it worked fine.

I was also able to test it on my Android phone using the web browser

Please leave a Facebook comment at the bottom of this article.

 //***************************************************** #define WEBDUINO_AUTH_REALM "Authentication Required" #include "SPI.h" #include "Ethernet.h" #include "WebServer.h" static uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; static uint8_t ip[] = { 192, 168, 1, 111 }; #define PREFIX "/control" WebServer webserver(PREFIX, 85); // Set the number of relays you want to be active. // Only active relays show on the web page // Inactive = 1 Active = 0 int Relay1active = 0; int Relay2active = 0; int Relay3active = 0; int Relay4active = 0; // Set the power up state of each relay //OFF = 1 ON = 0 int Relay1state = 0; int Relay2state = 0; int Relay3state = 0; int Relay4state = 1; //Button Labels String R1text = "Server Power"; String R2text = "Relay2"; String R3text = "PC Power"; String R4text = "Garage Door"; void defaultCmd(WebServer &server, WebServer::ConnectionType type, char *url_tail, bool tail_complete) { /* username = admin * password = admin * "YWRtaW46YWRtaW4=" is the Base64 representation of "admin:admin" */ if (server.checkCredentials("YWRtaW46YWRtaW4=")) { //************************** // process post data here //************************** if (type == WebServer::POST) { bool repeat; char name[16], value[16]; do { repeat = server.readPOSTparam(name, 16, value, 16); if (strcmp(name, "Relay1") == 0) { if (strcmp(value, "0") == 0) { digitalWrite(2, HIGH); } else if (strcmp(value, "1") == 0) { digitalWrite(2, LOW); } } if (strcmp(name, "Relay2") == 0) { if (strcmp(value, "0") == 0) { digitalWrite(3, HIGH); } else if (strcmp(value, "1") == 0) { digitalWrite(3, LOW); } } if (strcmp(name, "Relay3") == 0) { if (strcmp(value, "0") == 0) { digitalWrite(4, HIGH); } else if (strcmp(value, "1") == 0) { digitalWrite(4, LOW); } } if (strcmp(name, "Relay4") == 0) { if (strcmp(value, "0") == 0) { digitalWrite(5, HIGH); } else if (strcmp(value, "1") == 0) { digitalWrite(5, LOW); } } } while (repeat); server.httpSeeOther(PREFIX); return; } server.httpSuccess(); if (type == WebServer::GET) { P(messagestart) = "
<title></title>
&quot; &quot;&quot; &quot;
<h1>Power Control</h1>
&quot; &quot;

<form action="/control" method="POST">&quot;; P(messageend) = &quot;
<p><a href="/control/logout.html">LOGOUT</a></p>
&quot; &quot;</form>
&quot;; server.printP(messagestart); if (Relay1active == 0) { if (digitalRead(2) == 0){ server.print(&quot;

<p><button name="Relay1" style="background-color:#088A08; color:#FFFFFF;" value="0">&quot;); server.print(R1text); server.print(&quot; - is On</button></p>
&quot;); } else{ server.print(&quot;

<p><button name="Relay1" style="background-color:#CC0000; color:#FFFFFF;" value="1">&quot;); server.print(R1text); server.print(&quot;- is Off</button></p>
&quot;); } } if (Relay2active == 0) { if (digitalRead(3) == 0){ server.print(&quot;

<p><button name="Relay2" style="background-color:#088A08; color:#FFFFFF;" value="0">&quot;); server.print(R2text); server.print(&quot; - is On</button></p>
&quot;); } else{ server.print(&quot;

<p><button name="Relay2" style="background-color:#CC0000; color:#FFFFFF;" value="1">&quot;); server.print(R2text); server.print(&quot;- is Off</button></p>
&quot;); } } if (Relay3active == 0) { if (digitalRead(4) == 0){ server.print(&quot;

<p><button name="Relay3" style="background-color:#088A08; color:#FFFFFF;" value="0">&quot;); server.print(R3text); server.print(&quot; - is On</button></p>
&quot;); } else{ server.print(&quot;

<p><button name="Relay3" style="background-color:#CC0000; color:#FFFFFF;" value="1">&quot;); server.print(R3text); server.print(&quot;- is Off</button></p>
&quot;); } } if (Relay4active == 0) { if (digitalRead(5) == 0){ server.print(&quot;

<p><button name="Relay4" style="background-color:#088A08; color:#FFFFFF;" value="0">&quot;); server.print(R4text); server.print(&quot; - is On</button></p>
&quot;); } else{ server.print(&quot;

<p><button name="Relay4" style="background-color:#CC0000; color:#FFFFFF;" value="1">&quot;); server.print(R4text); server.print(&quot;- is Off</button></p>
&quot;); } } server.printP(messageend); } } else { server.httpUnauthorized(); } } void logoutCmd(WebServer &amp;server, WebServer::ConnectionType type, char *, bool) { server.httpUnauthorized(); P(logoutMsg) = &quot;

<h1>You have been logged out!</h1>

<p>Goodbye</p>
&quot;; server.printP(logoutMsg); } void setup() { if (Relay1active == 0){ pinMode(2, OUTPUT); //Set pin as output if (Relay1state == 0){ digitalWrite(2, LOW); } else{ digitalWrite(2, HIGH); } } if (Relay2active == 0){ pinMode(3, OUTPUT); //Set pin as output if (Relay2state == 0){ digitalWrite(3, LOW); } else{ digitalWrite(3, HIGH); } } if (Relay3active == 0){ pinMode(4, OUTPUT); //Set pin as output if (Relay3state == 0){ digitalWrite(4, LOW); } else{ digitalWrite(4, HIGH); } } if (Relay4active == 0){ pinMode(5, OUTPUT); //Set pin as output if (Relay4state == 0){ digitalWrite(5, LOW); } else{ digitalWrite(5, HIGH); } } Ethernet.begin(mac, ip); webserver.setDefaultCommand(&amp;defaultCmd); webserver.addCommand(&quot;index.html&quot;, &amp;defaultCmd); webserver.addCommand(&quot;logout.html&quot;, &amp;logoutCmd); webserver.begin(); } void loop() { webserver.processConnection(); } //***************************************************** 
Random Image
0021-48.jpg
Daily Quote

"51. If Helen Keller had psychic ability, would you say she had a fourth sense?"

George Carlin

Submitted by: gtgillis / 2007-05-13
Category: George Carlin Top 101 Jokes

Upcoming Events
There are no upcoming events