That’s broadly right, @chakahamilton, yes. I haven’t looked at the code you’re referring to, but that’s essentially it: read data then display feedback on the screen accordingly.
The exact code will depend on the data you’re trying to read; you’ll want to set led.configure() to DIGITAL_IN so you can - for example - get it to read a button. You read it with led.read(): when the value is 1, you send one string of text to the LCD via Message; when it’s 0, you send a different string or clear the screen.
I have a problem in controlling th imp remotely (ie) i see many videos in which people control the imp through their mobile phones using imp (both in android and ios) but the thing is how to do that or is there any ways to program in the agent window through which we create buttons in server side to control the imp?
If you can develop iOS or Android apps, @RAga, it’s easy to control imps via agents: you use the mobile OS’ in-built URL connection tools to send HTTP requests to the agent’s URL. You will need to configure your agent to respond to these requests and to pass on control and/or data-request messages to the imp.
Talking to the agent URL can also be achieved using a web browser and standard web programming techniques.
Check out The interactive imp to learn how to manage communication between app, agent and device.
If you’re an iOS user, I have an app foundation you can use to build your own control app. It’s on GitHub here
@RAga It is pretty easy to use jQuery in the agent to make a web control. If you use an iPhone, also check out Little Devil and Pitchfork on the app store.
@smittytone I wont be using a button. I will be using the agent code. In anycase how do i take the state of the Led save it then pipe it into the message field. (Again not a programmer so my terminology will be off) Do you have a code example?
Since you’re setting the state of the LED, you know what that state is - you don’t have to check the LED to find out. So you can write in your device code:
To learn how to send messages from the agent to the device, possible to set the text that displays on the LCD, check out The Interactive imp. This also covers sending info from the device to the agent.
Sorry to hear you got stalled with the imp @chakahamilton - but I’m glad you managed to finish your project!
The Electric Imp community is much younger and smaller than the Arduino community, so there’s less ready made code (and resources in general) floating around.
It’s something we’re working on - and something that is improving, but early communities are hard!