Show Posts
Pages: 1 [2]
16  Using Arduino / Storage / Reading microSD card directly from USB serial port on: January 27, 2011, 09:48:57 pm

Is it possible to read a microSD card (on a breakout) through the USB port on the arduino? or perhaps another USB port I could attach to the breakout?  Basically, I would like to read data off the card with my laptop without having to go and remove it each time!

17  Forum 2005-2010 (read only) / Syntax & Programs / Re: Confuzzled about Serial.print() behavior on: January 23, 2011, 04:08:18 am
You mixed up printIn with print. it is starting a new line with the number, and continuing the new line with the next print.

Coding late at night? ;D
18  Forum 2005-2010 (read only) / Syntax & Programs / Re: What is causing my time inaccuracy? on: January 20, 2011, 08:18:30 pm
Thank you all for the responses.  It's an Uno board that I just purchased, so it's probably the latest one.  I was just so surprised that the accuracy was THAT bad using the chip.  

I already ordered the Sparkfun RTC, our choices are very limited here in Singapore as far as local suppliers which we don't need to wait 2 weeks for.  The local companies seem to have 95% Sparkfun products :/
19  Forum 2005-2010 (read only) / Syntax & Programs / What is causing my time inaccuracy? on: January 19, 2011, 10:56:09 pm
Hello!, I have the code below to check the temp reading of a thermistor and send the output to both a serial LCD and a serial logger (well, just serial monitor for now)

It counts time with the time.h library, and controls the frequency of events with the aiko events library.  It works, but I let it run for 24 hours and the time was off by approximately 2 minutes... Is this inherent in the time.h way of counting time, or does it have something to do with the processing time of my loops (which would I suppose get worse with more complicated loops)?

PS: I realize that for this simple thing the Aiko events library is overkill, but I'm building a much bigger version.  

#include <Time.h>
#include <NewSoftSerial.h>
#include <math.h>
#include <AikoEvents.h>
using namespace Aiko;

NewSoftSerial LCD(2,3); // serial LCD

//user definable variables//
int LCDrefreshrate = 1; //lcd refresh rate in seconds
int templograte = 5; // temp log freq in seconds

double Thermister(int RawADC) {
 double Temp;
 Temp = log(((10240000/RawADC) - 10000));
 Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );
 Temp = Temp - 273.15;            // Convert Kelvin to Celcius
 //Temp = (Temp * 9.0)/ 5.0 + 32.0;// // Convert Celcius to Fahrenheit
 return Temp;

void setup()
  Events.addHandler(updatelcdtime, 1000);
  Events.addHandler(updatelcdtemp, LCDrefreshrate * 1000);
  Events.addHandler(templogserial, templograte * 1000);

void loop()
void updatelcdtime(){
  if(hour() < 10){
    LCD.print("0");// these ifs turn single digits to leading zero numbers
  if(minute() < 10){
  if(second() < 10){
  LCD.print("        ");
void updatelcdtemp(){
  LCD.print(" Celsius   ");

void templogserial(){ //modify this to reach logger properly
  Serial.print(" ");
void selectLineOne(){  //puts the cursor at line 0 char 0.
   LCD.print(0xFE, BYTE);   //command flag
   LCD.print(128, BYTE);    //position
void selectLineTwo(){  //puts the cursor at line 0 char 0.
   LCD.print(0xFE, BYTE);   //command flag
   LCD.print(192, BYTE);    //position
void goTo(int position) { //position = line 1: 0-15, line 2: 16-31, 31+ defaults back to 0
if (position<16){ LCD.print(0xFE, BYTE);   //command flag
              LCD.print((position+128), BYTE);    //position
}else if (position<32){LCD.print(0xFE, BYTE);   //command flag
              LCD.print((position+48+128), BYTE);    //position
} else { goTo(0); }

void clearLCD(){
   LCD.print(0xFE, BYTE);   //command flag
   LCD.print(0x01, BYTE);   //clear command.
void backlightOn(){  //turns on the backlight
    LCD.print(0x7C, BYTE);   //command flag for backlight stuff
    LCD.print(157, BYTE);    //light level.
void backlightOff(){  //turns off the backlight
    LCD.print(0x7C, BYTE);   //command flag for backlight stuff
    LCD.print(128, BYTE);     //light level for off.
20  Forum 2005-2010 (read only) / Syntax & Programs / Re: Long delay on: January 20, 2011, 08:32:17 pm
Why don't you use the aiko events library? I find it to be very easy to use.  It also makes the code look neater (I think anyway).
21  Forum 2005-2010 (read only) / Syntax & Programs / Re: Self-Destruct on: January 19, 2011, 11:16:36 pm
Could it be done with another board attached to it? like on triggering a digital in, the board could send serial commands to your arduino to reprogram it to whatever you want (bare minimum or ???)

If you could make that work, you could start testing a whole array of boards which could all reprogram each other on different conditions, right?
22  Forum 2005-2010 (read only) / Syntax & Programs / Re: ISR behavior questions on: January 11, 2011, 09:23:36 pm
hmm, seems to be some different styles of using code.  This is why I enjoy looking at other people's code- its sort of like hearing someone speak with an accent different than your own.  

well for now, I'm still learning to talk!
23  Forum 2005-2010 (read only) / Syntax & Programs / Re: ISR behavior questions on: January 11, 2011, 10:10:32 am
It's up there, on the right, and is labelled "search"

oops! why would they hide it in that box next to the "search" button  smiley-wink
24  Forum 2005-2010 (read only) / Syntax & Programs / ISR behavior questions on: January 11, 2011, 09:36:24 am
Hello Everyone!

I was looking for a search button, but couldn't find it   :-/

Just a few simple questions about how sketches handle interrupts.

 Will an interrupt function be called during ANY function? As in, while my sketch is running its various functions outside of loop(), will the interrupt still be active?

When the conditions causing the interrupt end, will the sketch exit the interrupt function called by it immediately? Or, will it finish the function?

At the end of the function called by the interrupt, will the main loop() continue at the point where the interrupt happened, or start at the beginning?

Thank you!!
25  Forum 2005-2010 (read only) / Bar Sport / Re: Getting into the interaction design world? on: January 23, 2011, 08:30:11 pm
I second (or third) going to burningman.  If you make something epic enough, some of those LSD-hippies might notice- and you would be surprised I think to find out that some of them are or have close friendships with MIT folks.  

If nothing else, do it for fun, you are blessed with thinking outside of the academic club (box).  Sure, in that setting you will learn alot, but you will learn what the other 20+ people in your program are also learning.  If you are soldering and programming at 3am in your basement, your full creativity can be realized without a professor telling you the 'proper' way to do things.  

-I never understood 'art' schools

Pages: 1 [2]