I'm using an Electric Imp to control the above display. I'm passing commands over a serial connection and ultimately want to display images from the uSD card.I'm having issues when I send some commands. The images and animation on the card display correctly using Serial Commander and in the Arduino environment (sending write commands in Hex rather than using the libraries)Running the following code on the Imp clears the display screen and logs an Ack response (6)
Running the following code to Set sector address at HIword 0x0000 LOword 0x0000 results in 'No data returned' logged, the screen saver stops due to serial communication but does not re-start after 5 seconds and the display requires a re-boot.
//Code to set sector address hardware.uart12.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS); server.log("begin code"); imp.sleep(3); hardware.uart12.write(0xFF); //Set sector addresshardware.uart12.write(0xB8); hardware.uart12.write(0x00); //HIwordhardware.uart12.write(0x00); hardware.uart12.write(0x00); //LOwordhardware.uart12.write(0x00); imp.sleep(0.1); local result = hardware.uart12.read(); if (result == -1) { server.log("No data returned."); } else { server.log(result); } server.log("code has run"); imp.configure("4D sytems", [], []);
I've tries putting in delays of up to 0.5 seconds between each serial write to try and solve this, but it made no difference. I have tried using just
but it doesn't seem to make any difference. I've also tried swapping the MSB/LSB positions but this always produced 'No data returned'Any help appreciatedDougie
HTML Code:
//Code for CLS hardware.uart12.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS); server.log("begin code"); imp.sleep(3); hardware.uart12.write(0xFF); //CLShardware.uart12.write(0xD7); imp.sleep(0.1); local result = hardware.uart12.read(); if (result == -1) { server.log("No data returned."); } else { server.log(result); } server.log("code has run"); imp.configure("4D sytems", [], []); Running the following code results 'No data returned' being logged, however, the screen saver activates after 5 seconds and re-running the code results in an Ack response (6) being logged //Code to initialise SD card hardware.uart12.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS); server.log("begin code"); imp.sleep(3); hardware.uart12.write(0xFF); //Media inithardware.uart12.write(0xB1); imp.sleep(0.1); local result = hardware.uart12.read(); if (result == -1) { server.log("No data returned."); } else { server.log(result); }server.log("code has run"); imp.configure("4D sytems", [], []);
//Code to set sector address hardware.uart12.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS); server.log("begin code"); imp.sleep(3); hardware.uart12.write(0xFF); //Set sector addresshardware.uart12.write(0xB8); hardware.uart12.write(0x00); //HIwordhardware.uart12.write(0x00); hardware.uart12.write(0x00); //LOwordhardware.uart12.write(0x00); imp.sleep(0.1); local result = hardware.uart12.read(); if (result == -1) { server.log("No data returned."); } else { server.log(result); } server.log("code has run"); imp.configure("4D sytems", [], []);
I've tries putting in delays of up to 0.5 seconds between each serial write to try and solve this, but it made no difference. I have tried using just
HTML Code:
hardware.uart12.write(0xFF); //Set sector addresshardware.uart12.write(0xB8); without sending Hi & LOword parameters but always get 'No data returned' Can anyone make any suggestions?I've also tried the format hardware.uart12.write(0xFFB1); //Media init
Comment