tag:blogger.com,1999:blog-6238454757421809452.post8870172579054459432..comments2024-01-29T06:22:58.174-05:00Comments on The Raspberry Pi <br>Hobbyist: ThingSpeak API for Internet of Things Ted B Halehttp://www.blogger.com/profile/16887056993667506084noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-6238454757421809452.post-31243035579263976682019-05-09T05:27:18.001-04:002019-05-09T05:27:18.001-04:00Please fix indentation since it has been wrongly f...Please fix indentation since it has been wrongly formatted automatically by the browser/pageberthttps://www.blogger.com/profile/00519016939582930808noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-11519898029461721492019-05-09T05:26:28.257-04:002019-05-09T05:26:28.257-04:00import string
import time
import smtplib
import ma...import string<br />import time<br />import smtplib<br />import math<br />import httplib, urllib<br />from email.MIMEMultipart import MIMEMultipart<br />from email.MIMEText import MIMEText<br /><br /><br />updateThingspeak = 15 # how many seconds to sleep between posts<br />key = '************' # Thingspeak channel to update<br /><br /><br />def updateTHINGSPEAK():<br /> while True:<br /> params = urllib.urlencode({'field1': 0.1, 'field2': 0.2, 'field3': 0.3, <br />'field4': 0.4,'key':key }) <br /> headers = {"Content-typZZe": <br />"application/x-www-form-urlencoded","Accept": "text/plain"}<br /> conn = httplib.HTTPConnection("api.thingspeak.com:80")<br /> try:<br /> conn.request("POST", "/update", params, headers)<br /> response = conn.getresponse()<br /> conn.close()<br /> except:<br /> print 'connection failed'<br /> break<br /><br />while 1:<br /> updateTHINGSPEAK()<br /> time.sleep(5)<br />berthttps://www.blogger.com/profile/00519016939582930808noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-70038553058281709782019-05-09T03:19:28.538-04:002019-05-09T03:19:28.538-04:00Sure ! I would like to refer python code for the s...Sure ! I would like to refer python code for the same.<br />please do share .<br /><br />Thank you.<br />abstract_17https://www.blogger.com/profile/02487833666477150345noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-63037905070747633082019-05-08T11:38:07.885-04:002019-05-08T11:38:07.885-04:00Hey, I am sorry but I am no longer working on this...Hey, I am sorry but I am no longer working on this project and I have lost most of the stuff but at the end I remember I had understood that it was better to move from C to Python...if you are interested I can share Python code...<br /><br />Alessandroberthttps://www.blogger.com/profile/00519016939582930808noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-85412232856459276552019-05-08T03:23:24.031-04:002019-05-08T03:23:24.031-04:00i am trying to implement the same . Can you please...i am trying to implement the same . Can you please share your implementation of this API ?<br /><br />Thank You in advanceabstract_17https://www.blogger.com/profile/02487833666477150345noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-79242898251999077962019-01-08T17:06:25.042-05:002019-01-08T17:06:25.042-05:00Hi, nice job...
Can you provide similar code to re...Hi, nice job...<br />Can you provide similar code to read data from Thingspeak?Anonymoushttps://www.blogger.com/profile/07326633726894388054noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-66280096755883858972017-09-11T07:47:09.749-04:002017-09-11T07:47:09.749-04:00Was able to overcome the issues.
Working fine.
G...Was able to overcome the issues.<br /><br />Working fine.<br /><br />Great.<br /><br />Anonymoushttps://www.blogger.com/profile/07460349593393469766noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-9333442934439392102017-09-11T00:38:42.706-04:002017-09-11T00:38:42.706-04:00And if I replace Log with printf, following error ...And if I replace Log with printf, following error is encountered<br />a.c:10:6: error: conflicting types for ‘printf’<br /> void printf(char *format, ... );<br /> ^~~~~~<br />In file included from a.c:2:0:<br />/usr/include/stdio.h:364:12: note: previous declaration of ‘printf’ was here<br /> extern int printf (const char *__restrict __format, ...);<br /> ^~~~~~<br />pi@raspberrypi:~/speak $<br /><br />Pls do let me know the issues here.<br /><br />Just starting with Raspberry <br /><br />Thanks in advance <br />Anonymoushttps://www.blogger.com/profile/07460349593393469766noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-20655462344068970322017-09-11T00:36:13.252-04:002017-09-11T00:36:13.252-04:00I am trying to implement the above program and get...I am trying to implement the above program and getting following error<br />/tmp/ccBKEEhS.o: In function `write_data':<br />a.c:(.text+0x344): undefined reference to `Log'<br />/tmp/ccBKEEhS.o: In function `UpdateThingSpeak':<br />a.c:(.text+0x3e8): undefined reference to `Log'<br />a.c:(.text+0x4c0): undefined reference to `Log'<br />a.c:(.text+0x4d0): undefined reference to `Log'<br />a.c:(.text+0x524): undefined reference to `Log'<br />without making any changes to the program as it is Anonymoushttps://www.blogger.com/profile/07460349593393469766noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-2578872071337244352017-02-26T04:05:01.888-05:002017-02-26T04:05:01.888-05:00Ok, got it. I have customized your function Update...Ok, got it. I have customized your function UpdateThingSpeak for my needs, tested and everything work properly. Thanks so much! Cheers! berthttps://www.blogger.com/profile/00519016939582930808noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-68070815838570410792017-02-25T21:25:48.258-05:002017-02-25T21:25:48.258-05:00The code listed in the post above will update a th...The code listed in the post above will update a thingspeak feed with two variables. It needs to be modified for other configs<br /><br />Here is how to call it (you need your own key)<br /><br /> sprintf(temp,"%d",someVariable);<br /> sprintf(temp2,"%f",someOtherVariable);<br /> UpdateThingSpeak("DFLGGKEFTRKREHKY", "field1", temp, "field2", temp2);Ted B Halehttps://www.blogger.com/profile/16887056993667506084noreply@blogger.comtag:blogger.com,1999:blog-6238454757421809452.post-13797549593014005482017-02-25T16:07:09.202-05:002017-02-25T16:07:09.202-05:00Hi, how can I use your API? Can I see some example...Hi, how can I use your API? Can I see some examples? Thank you very much!berthttps://www.blogger.com/profile/00519016939582930808noreply@blogger.com