I use an Arduino Pro 328 - 5V/16MHz and tiny 4D display, until now it works fine
Good point about the serial ports… mmmmm!! I think that we need to ask to some Serial comunication guru ;D
could be that using SoftwareSerial LIB can help us but I don’t know if this increase dramatically the execution time (i guess you need to messure with an oscilloscope), other posibility can be use some compiler instructions on LIB, so when Arduino complie code it insert correctlly waht serial port is called by the PDE file. :-?
based on your observations I modify some Methods on code
uOLED::uOLED(int pin, int baud)
BRate = baud;
//Make a Reset for uOLED and Clear Screen
//Send 0x55 to stablish baud rate for serial communication
I just move Serial.Begin from class constructor to StartUp, this is important because as soon as you call Serial.begin it also takes care about TX pin line to put it into HIGH becasue HI state signal on RS232 means no data is send, when Serial.print (or any other send function) is called TX signal follows RS232 protocol (start bit, data bits, stop bit). I also verify this with oscilloscope. On your cade you manipulate manually TX pin that in my pont of view has no sense!
I put RBack as private method that modify a public attribute into the uOLED class because not always is needed to verify or debug response from 4D Display if you want to check respronse just type
4DDisplayResponse = My_uOLED.res;
I haven’t tested neither how works Serial.write compared with Serial.print (data,BYTE) this will be a good exercise to test, waht I see that Serial.write use less space when you compile the code
if you want to add a instruction on LIB follow this steps
- On uOLED.h declare as Public method the function
unsigned int ReadPixel(chat x, char y)
- into uOLED.cpp coding the function as a member of uOLED class
unsigned int uOLED::ReadPixel(chat x, char y)
unsigned int data;
res=RBack(); //wait for ACK
- on your PDE program just call method
PixelColor = my_uOLED.ReadPixel(10,10);
I hope this can help!