What is the best way to send small wires from PC to Android and from Android to PC?
I have an ordino that reads the temperature value from two sensors and sends them to an application. I would like to create an Android application that reads these values through the internet and shows them in the screen of their smartphone. Is there a guide to sending small strings or something like this? I want a very easy guide as easy as possible, because I'm starting.
You can use to send your data from the computer URLB2, urllib mydata = [(' A ',' 1 ']] # The second name of the first name is the value of mydata = urllib.urlencode on the web server:
Import (Mydata) path =' http: / /localhost/new.php '# url You want to post to req = urllib.request (path, mydata) req.add_header ("content type", "application / x-www-form-urlencoded") page = urllib2 .urlopen (req) .read () Print Page File them on the server Take:
& lt ;? php $ file = "path / to / file / here"; File_put_contents ($ file, $ _POST ['one'], FILE_APPEND | LOCK_EX);? Gt; Now develop your Android app which reads the value from the file.Append or whatever you need to save all the data or if you want to replace the data, Then use it.
Otherwise, you can use just one connection to send serial data between your device. (on ANdroid Developer) You may also be interested in and .
No comments:
Post a Comment