Oso Stat

Motocross Hour Acquisition/Logging/Tracking System

Prototype v002 Code

Posted by Taylor Bernard on June 5, 2013

took out what i thought we didnt need from the old code, not throwing any errors so far.
can you take out where it prints 'blink' like every 100ms or so, i want to slim it down so we can print the date and elapsed time to EEPROM next.

heres file

Comments

Justin Bernard on June 5, 2013:

see if this does what you're looking for.  took out any blinking.

Taylor Bernard on June 5, 2013:

its not returning anything in serial monitor now. i think somehow the actual button state got messed up in that edit. basically turning off HIGH/LOW. cause no date, elapsed time, ect is showing, acting like nothing pressed at all.

Justin Bernard on June 5, 2013:

try attached one.

all i did was comment out
// digitalWrite( ledPin, _value ); (line 194)
and
// digitalWrite( ledPin, LOW ); (line 198)

thats where it's actually blinking.

Taylor Bernard on June 6, 2013:

ok now its acting like the one i sent you. its relaying '*BLINK*' every 100ms or so still.
i want it to blink, just dont want it to print it in the com.

Justin Bernard on June 6, 2013:

oh misunderstood. you want it to blink, but just not write to card that it is?

if so, comment this out

// Serial.print( "*** LED BLINK ***" ); (line 184)

Taylor Bernard on June 6, 2013:

ok all good now.
Lets see if we can write something to the EEPROM.

most of the code out there has write limitations to it, and you had to do a work-around on getting larger byte strings.

found this, supposedly can read/write long strings. see if this makes any sense. looks like a lot of ++> if (0) ; and math but just look at the communication side.

http://playground.arduino.cc/Main/LibraryForI2CEEPROM

Justin Bernard on June 6, 2013:

see what this does.

Taylor Bernard on June 6, 2013:

sketch_jun06a:12: error: 'I2C_eeprom' does not name a type
sketch_jun06a.ino: In function 'void setup()':
sketch_jun06a:47: error: 'I2C_EEPROM_VERSION' was not declared in this scope
sketch_jun06a.ino: In function 'void dumpEEPROM(unsigned int, unsigned int)':
sketch_jun06a:168: error: 'ee' was not declared in this scope
sketch_jun06a.ino: In function 'void logData()':
sketch_jun06a:224: error: 'ee' was not declared in this scope

Taylor Bernard on June 6, 2013:

also add in hr/min/sec into the RTC stamp, it'll help us identify it got written when we wanted it to:

  Serial.print( " --- " );
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);

Justin Bernard on June 6, 2013:

hmmm. way too many new things i'm not familar with.  lets do it this way and isolate things.  see if you can get this example sketch running. i have no idea pin configuration/etc you have setup.  see if this does it (attached) , refer to link you posted earlier if have issues, let me know if it works...

Justin Bernard on June 6, 2013:

Taylor Bernard on June 6, 2013:

troll code lol

Taylor Bernard on June 6, 2013:

one of best lines of movie

"this is easy, its a unix based system" - 12yr old girl

Justin Bernard on June 6, 2013:

programmers love that movie.

Taylor Bernard on June 6, 2013:

that guys files are full of errors when i try to compile, directories missing, mis-named files, ect.. let me try to find someone elses library for i2c eeprom.

Justin Bernard on June 6, 2013:

crazy. happens all the time to me looking through AS3 examples.  i'd never ever ever post code online if i hadn't run/tested it.  dont get it.  its more hurtful than helpful because its just clouding avail information/learning.

Taylor Bernard on June 7, 2013:

take a look at this and see if you can figure bug out...

in the sketch, about 5th line WAS:
I2C_eeprom ee(0x50);

was throwing error so made it:

#define I2C_eeprom ee(0x50);

now its saying later in the loop at:
ee.setBlock.....

sketch_jun07a.ino: In function 'void loop()':
sketch_jun07a:22: error: 'ee' was not declared in this scope
sketch_jun07a.ino: In function 'void dumpEEPROM(unsigned int, unsigned int)':
sketch_jun07a:68: error: 'ee' was not declared in this scope

only place i can find 'ee' is right at the top in the #defines, looks like they are trying to make 'ee' defined for the name and location of device ( i2C_eeprom @ 0x50 address ) so they can use it shorthand for ee later in code. somehow its not formatted right

heres cpp and h files as well.

Taylor Bernard on June 12, 2013:

heres supposedly updated code for arduino 1.0

http://playground.arduino.cc//Main/LibraryForI2CEEPROM

this same part of code is throwing error though.....

/*
 *  Example: I2C bus - EEPROM 24LC256
 */

#include <Wire.h> //I2C library
#include <I2C_eeprom.h>

I2C_eeprom ee(0x50);



that last line defines the address of the device (0x50). but there is no #define  in front of it.

throws an error:
"sketch_jun11a:8: error: 'I2C_eeprom' does not name a type"

when i put #define in front of it, like some other guys code when they are naming device, it skips error on that section but throws one a few lines down in the (loop):

"sketch_jun11a:22: error: 'ee' was not declared in this scope"

on the 'ee.setBlock' line

in:

void loop()
{

Serial.println("\nTEST: 64 byte page boundary writeBlock");
  ee.setBlock(0,'0',100);
  dumpEEPROM(0, 80);



-----

up in the #define I2C in the header, it has the ee label up there. thats only place i can find that 'ee' tag, even in the .cpp and .h files. so its gotta be formatted incorrectly. maybe a space after 'ee' and before device address? something is up with that.

Taylor Bernard on June 12, 2013:

here is another guys code. he is using that 'ee' tag too. i dont think his works for arduino 1.0, but may can pull some snippets out...

http://apexlogic.net/code-bank/arduino/eeprom-i2c-write-anything/


look like he's defining 'ee' in the .H file:

template <class T> int eeWrite(int ee, const T& value)


in the other guys .H file and sketch theres no ee reference.

Taylor Bernard on June 12, 2013:

hey make sure in your book the EEPROM described is 'i2C' eeprom.
cause theres onboard eeprom that doesnt save data when power is turned off. its super easy to write to. the i2c that we have is external, and saves data when power is off, its a lot trickier code and done a completely different way.