I/O inquiry. - Help finding issues with input

So I’m almost positive that the error is due to my lack of skill, lol… However,  I can’t seem to wrap my head around why I can’t feed input into my Impee with this:  


I have output working correctly and I can post my results without an issue to a remote server using the POST node.  

Inputting however doesn’t seem to be functioning.  My log is showing random hex strings with Instance :  in front of it, rather than what I’m posting via the api url.  

Any ideas on how I can repair this to only care about input when it receives it and to be able to use/reference the input received throughout the entire code if need be? 

So one issue I can see is that you are doing this:


local input = InputPort(“value”);
…which is incorrect, as you then pass it to the imp.configure. (a) this will go out of scope, and (b) I think you wanted to pass rfidDevice as your input. You want rfidDevice.set() to be called when you have input, right?

I’ve never tried doing an imp.configure() inside a constructor, especially the constructor of the object that you actually want to pass to it. You’re also declaring other input objects elsewhere?

The easiest structure to understand is to create your objects - input and output - THEN, at the root level, do the imp.configure() and start any imp.wakeups that you may want for polling.

There are quite a lot of issues with that code. Primarily I don’t think you’ve grasped how InputPort works - I’d advise reading over the API documentation and reviewing some of the examples again. In summary, this:


local input = InputPort(“value”);

does not do what you think it does. You’re creating a new instance of an InputPort there (incorrectly, as you’re not specifying a data type for the port) and not retrieving a value from an existing port. Data is retrieved by overriding the set method, which you do inside rfidDevice.  rfidDevice is your InputPort, so data is received asynchronously from your poll. 

The fetchData class doesn’t seem to have much point and it further confuses the scope of everything. The input and output ports in this example don’t seem to have much function anyway. For the sake of clarity I’ve updated your code into something that looks like it might do some of what you’re looking for (completely untested!).

http://pastebin.com/Fu8Egp4G

Rob