Category Archives: Feldman Project

Tom DeVito 7.6.2011

Start: 10:15

  • Found one of the major problems.  The arduino serial buffer can only handle 128 bytes.  Was using 256 which was causing an overflow.
  • Adjusted all send/receive buffers down to 128.  Lowered the max number of character for the data entry name to 16 characters down from 64.
  • Seems that the runtime errors I was having are resolved.  The arduino seems fine with a call to the getName() function but I cannot save the returned value to a char array for some reason.

End: 6:15

Tom DeVito 7.5.2011

Start: 10:15

  • Thought I had figured out the looping problem before but it turns out I was skipping over some important steps.
  • Added the steps that were missing.  Most have to do with the DataDictionary.
  • The Arduino keeps choking.  I assume this is because of runtime errors
  • Started debugging line by line using a continuous send to light an led to tell me if the arduino hit an error. If it does the light turns off.
  • The arduino seems to be very picky about initializing variables before assigning them.  Things like DataElement* ptr = getItem(name); seem to cause errors
  • I was able to fix a lot of the runtime errors but am still having a problem with importData.  The line that seems to have the problem is where it gets the name from the DataElement.
  • I took out the size bytes in the send receive to make sure this wasn’t causing problems.  It is now set to send or receive the full 256 byte buffer.

End: 6:30

Tom DeVito 7.1.2011

Start: 10:15

  • Found out the hard way that the arduino IDE doesn’t save automatically and, if you shutdown your computer, it will close automatically without asking if you want to save.
  • Spent most of the day getting the sketch back to where it was at the end of yesterday.  Will remember to save manually more.
  • Renamed and moved the PC side desrialization method to datadictionary::importData(char* buffer).  gets the name from the buffer, checks if the item exists,  then imports data from buffer to the local memory location.

End: 6:15

Tom DeVito 10.29.2011

Start: 10:00

  • Fixed a problem with PC receive method.
  • Fixed the deserialization method.
  • Single pass works both directions.
  • Found a problem with the states that was causing it not to loop properly.
  • Changing the code to receive sensor data and have the pc respond with commands to the arduino based on the data.
  • Commands will light 5 leds based on the pressure of the sensor.

End: 6:30

Tom DeVito 6.28.2011

Start: 10:30

  • Add a method to get the total size of the data element with the data so it could be loaded into the buffer easier
  • Was importing the size into the buffer which was causing the deserialization to not work correctly on the arduino side.
  • Arduino side is able to get data from the wire.
  • PC recieve doesn’t seem to be working correctly for DataElements

end: 6:30

Tom DeVito 10.24.2011

Start: 10:30

  • Continued writing test application
  • Tested it but its not working.  Wire lights light up but the data isn’t going to the right place.

End: 2:30

Left early to go on a camping trip.

Tom DeVito 6.23.2011

Start: 10:30

  • Edited the de-serialize method on the pc side so it should work with wire data.
  • Changed the size to be type char for now so that I didn’t have to worry about it being a 2 byte integer
  • Changed how receive data worked
  • Started writing a test application to send commands to the arduino and have them echoed back
  • Added states to the pc test application

End: 7:30

Tom DeVito 6.22.2011

Start: 10:40

Arduino Communications:

  • Wrote a sketch to handle the communications and deserialization on the arduino side
  • Everything should work but I need to fix the PC side deserialization which is currently setup as a test method
  • Once I know all the methods work I will put them into a ArduinoCom library to keep the main sketch from getting cluttered
  • sendData may need some stuff added to it.

Notes:

  • It is fine to send the DataElements individually instead of one buffer which is how I thought it had to be done
  • Serial.write needs a uint8_t* to the buffer.  I figured they are both 8 bit pointers so I just casted my char*.

End: 5:30

Have to be somewhere at 6:30 will make up the extra hour and change tomorrow.

Tom De Vito 6.21.2011

Start: 10:10

ComConsole:

  • Made a library for the ComConsole, ComMgr, and Printable classes
  • ComMgr’s sendData, recieveData, and toString were set to virtual
  • Not sure why but, when I added the libraries to a new project, it complained about the libraries being in RELEASE instead of DEBUG.  They both worked in the other project and I couldn’t find any properties for this.
  • Recompiled them as DEBUG

DataDictionary:

  • Changed all instances of 32-bit integers to 16-bit so the Arduino matches up.
  • Added type parameter and associated methods to DataElement.

Serialization/Deserialization:

  • Figured out how to extract data from the receive buffer.
  • Tested the PC side Serialize and De-serialize.
  • At first I was copying the DataElement out of the buffer but eventually figured out how to read it straight from the buffer
  • Started writting a method for the arduino to Deserialize.

End: 6:30

Tom DeVito 6.20.2011

Start: 10:00

C++ Libraries

  • Just use the .h files from the library source.  I thought they had to be special.
  • If you don’t want to change a bunch of properties you can drop the .lib and .h files in the source root directory
  • Phil recommended making  include and lib directories in the source folders to help with organization.
  • On the arduino side it seems you cannot use pre-compiled libraries.  I looked all over and could not find one example of someone who used anything but the source.
  • Put the source into a folder and then drop it into the libraries folder of the arduino IDE.
  • Make sure to disable pre-compiled headers for non-windows libraries.
  • new and delete are not defined properly in the arduino IDE.  The following is needed for these functions to work properly.
#include <stdlib.h> // for malloc and free
void* operator new(size_t size) { return malloc(size); }
void operator delete(void* ptr) { free(ptr); }

Communication:

  • Setup serialization methods to return a char*.
  • Changed getData to have a special case for remote data which it handle differently.

End: 6:30

Tom DeVito 6.17.2011

Start: 10:00

Creating a Library:

Com Console:

  • Got a bit annoyed with the Library not working so I decided to continue setting up the Com Console for when I have the Data Dictionary in it.
  • Made it so all the data elements of command and response were in a struct and changed the set get methods to work with this.

End: 6:30

6/19/2011 Note: I tried the library again on Sunday.  Its not giving me compiling errors anymore but I haven’t really tested it yet.  I will try to test it tomorrow.

Tom De Vito 6.16.2011

Start: 10:00

Data Dictionary:

  • Found that you can’t compare char* directly.  First tried strcmp(char* first, char*second) but found this only compares the first char in string.
  • strncmp(char* first, char*second, size)  is the way to go.  Was originally using a defined maximum but Phil told me it would be better to make sure the string length is equal first then set the size to the string length.
  • getData(char* name) implemented
  • deleteItem(char * name) implemented
  • added toString() to print out current contents

Com Console:

  • Cleared all test code
  • Added sendBuffer and recieveBuffer to ComMgr
  • Added toBuffer methods to command, response, and state classes.

End: 6:30

Tom DeVito 6.15.2011

Data Dictionary:

  • Had very strange compiling errors.
  • Moved project to its own solution.  Problem was not resolved.
  • Eventually realized that DataElement.h was missing a ; at the end.
  • Changed addItem and DataElement to have the void* to the data in their parameters/constructor.
  • Changed addItem to return void.

Tom De Vito 6.14.2011

Arduino to PC Communication:

  • Was able to pass a structure back from the arduino
  • recieveData gets the buffers pointer and writes to the buffer.
  • To make testing easier all this is still done within the ComMgr.

Data Dictionary:

  • Phil helped set up the data dictionary.
  • use strcpy(des, ori) to copy a char*.3
  • Anytime malloc or new is used, remember to free resources.
  • Still not sure how data is put into the data elements.

Tom De Vito 6.13.2011

start: 10:30

Communications Testing:

  • The Arduino’s Serial.available() alone will only recieve 1 bit.  It needs to be set equal to some number to receive more.
  • The Structure finally passed and casted correctly once I got the array to load properly
  • The original test structure had chars as its data members.  This worked with no problem.
  • The Arduino uses 16 bit integers while visual C++ defaults to 32 bit integers.  In order to pass structures with integer data members you have to make sure that you pass 16 bit ints.

#include <stdint.h>

int16_t var;

  • PC now can send properly and the arduino can recieve properly
  • Set up Arduino to PC communication.  Not working properly yet.

end: 6:30