Man, I kinda suck at this. maybe my 45 year old brain with no network programming experience is just to rubberized to learn this. I hope not. I have plans!
So perhaps someone could help out an IMPnoob who has 25 years of C programming (but not object oriented programming, although I get the idea, and program in an object orient way) and microcontroller experience but beyond basic HTML has little or no experience programming for internet.
Here is where I am:
I get how to program IMPs
I get the planner
I can make short programs and load them
I made a blinky program
I made a readPot program
I have used tictock to drive blink
But I am really interested in getting data into and out of the IMP and seeing it on the internet. But I have to start slow. So basically I want to start by having a website where I enter a value (0 or 1) and have my LED turn on and off based on this number. Then I would like to send the pot voltage to a website.
For the first part, I am using http://www.jmarshall.com/easy/html/testbed.html as a test bed to send values to the imp. This doesnt work and I dont know if its because its going through the simulator or if its just because I suck.
The HTTP in box says, “with at minimum a value parameter and optionally a channel parameter.” I dont know what this means with regard to what needs to be sent. Further, I tried to hook a “show input” to the HTTP in node, and I am getting nothing but a 0 there.
So, can someone step me through this here? My blinky code is pretty straight forward:
`class LED extends InputPort
{
type = "integer"
name = "LEDState"
function set(value) {
hardware.pin9.write(value);
}
}`
and I tried the following html code to send a value to my imp:
`
number:
`
didnt work at all. Can someone help me get this simple stuff to work and assume I am 8 years old as you go through it?
Do you happen to have access to a website where you can use PHP?
Or maybe I should ask if you may want to subscribe to a webhost to get your own website.
It only costs $40 for the first year (special price) … $60 after that. Cleverdot.com
That is pretty cheap for a website that you can do whatever you want… with your own domain name.
So you have your node and you have your imp running. I can post some PHP example scripts that you upload to a website. Or I am willing to make a test page for you on my website that you can use to post values to your imp. But you will really want your own website so you have access to all of the scripts.
But don’t get discouraged. You’ll catch on. This is a great forum.
Do you happen to have access to a website where you can use PHP?
yes, thats not a problem. It was just faster and easier to use the test bed. So, yeah if you have some basic examples with descriptions of exactly what is happening I’d really appreciate it.
I’m not discouraged, its just that there is so much internet lingo and mechanics to understand just to get a 1 or a 0 to my imp, its hard to get over that hurdle without some help. At least for me.
Let’s just start with the very simplest form to post a value to the imp …
Upload this script, call it “test1.php” and then go to your URL to enter a value and submit it. You should then see the value show up in the HTTP_IN node.
This requires no PHP, but get in the habit of using .php for future scripting.
`
number:
`
After you hit submit, you should see an “OK” appear on the browser.
Your value should appear in the HTTP_IN node.
At this point you don’t need any scripting in the imp. You can just use the planner to make sure the value is coming in.
The next post, we’ll turn on an LED with you enter a value of 1.
Thank you. A lot. I appreciate this. Unfortunately I am in the boonies right now and can’t get to work on this until at least tomorrow. I should have brought my Imp!