uart - Using ElectricImp server.show() and Arduino -


i'm following sparkfun tutorial connecting arduino electric imp. have 1 arduino , imp, i'm trying whatever type in arduino serial monitor display in imp node using server.show().

i've modified 1 of functions in sparkfun code this:

function polluart() {     imp.wakeup(0.00001, polluart.bindenv(this));  // schedule next poll in 10us      local byte = hardware.uart57.read();  // read uart buffer     // return -1 if there no data read.      while (byte != -1) // otherwise, keep reading until there no data read.     {         // server.log(format("%c", byte));  // send character out server log. optional, great debugging         // impeeoutput.set(byte);  // send valid character out impee's outputport          server.show(byte)         byte = hardware.uart57.read();  // read uart buffer again (not sure if it's valid character yet)         toggletxled();  // toggle tx led     } } 

server.show(byte) displaying seemingly random numbers. have idea of why is, don't know how fix because i'm not familiar uarts , squirrel.

local byte = hardware.uart57.read(); reads in ascii characters arduino in byte form (i think), , they're not being 'translated' ascii characters before use server.show(byte). how do in squirrel? also, think polling every 10us wrong way go here. i'd poll when there's new information, don't know how in squirrel. can point me example happens?

thanks!

i think passing wrong data type show method of server object. electric imp docs state takes string, server.show(string). think local correct type receive value hardware.uart57.read(). can tell docs well. so, need find way cast byte string. bet find answer here. read squirrel use's unicode there function takes unicode bytes , loads them string object.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -