Show Posts
Pages: 1 2 [3] 4 5
31  Development / Other Hardware Development / Re: STM32F4-Discovery Shield on: October 18, 2011, 09:12:35 pm
I got one free and i'm in Canada. Got it yesterday. Great stuff.
32  Using Arduino / Project Guidance / Re: Heart rate monitor on: September 18, 2011, 11:32:52 am
How about Heart rate + midi
From 2008: http://www.flickr.com/photos/recotana/2283848566/in/photostream/

33  Using Arduino / Project Guidance / Re: Heart rate monitor on: September 17, 2011, 01:36:55 pm
I know, but I don't have the strap.
The strap "T31" cost only ~20$ at any Healt/sport boutique near you. It is good for two years if used at average one hour a day.
34  Using Arduino / Project Guidance / Re: Heart rate monitor on: September 17, 2011, 12:07:00 pm
it works really fine

http://socialcam.com/v/qVuccBHT
35  Community / Bar Sport / Re: Your latest purchase on: September 17, 2011, 11:51:39 am
Those displays are pretty cool!
When you have a look at the command set, it kinda leaves you wondering what your Arduino is going to be doing!
They have multiple UARTS, SPI, I2C, GPIO pins.
I think the language has built in support for parsing NMEA sentences.



Wow! didnt know that. Really cool device indeed.
36  Community / Bar Sport / Re: Your latest purchase on: September 17, 2011, 11:49:58 am
Very nice display, what you are going to do with it ?



GPS related project.
37  Community / Bar Sport / Re: Your latest purchase on: September 17, 2011, 06:44:08 am
I just bought this from Australia. Works with Chipkit32 Uno and Arduino
3.2" Serial LCD-TFT Display Module (with Touch) 100$ shipping to Canada included
http://www.4dsystems.com.au/prod.php?id=113



38  Using Arduino / Displays / Re: Backlight control by PWM help on: September 15, 2011, 09:01:46 pm
http://forums.adafruit.com/viewtopic.php?f=25&t=16478

Code:
                               LCD Pin 16          +5V
                                |                   |     
                                |                   |     
                       1k      /               LCD Pin 15         
Arduino digital pin -/\/\/\---| npn
                               \
                                |
                                |
                               GND
39  Using Arduino / Project Guidance / Re: MIDI Controller on: May 03, 2011, 01:59:26 pm
Few years back (summer 2008) i had this idea





40  Forum 2005-2010 (read only) / Syntax & Programs / removing delay() in DallasTemperature.cpp on: July 26, 2009, 06:44:20 am
My project require the use of a Dallas temperature sensor and the my program already execute other functions that can not be delayed at all. The Dallas need a 1 second delay everytime a request is made. How DallasTemperature.cpp program can be modified to not use delay() but millis() instead ?

http://milesburton.com/downloads/Arduino/DallasTemperature/DallasTemperature.rar

Code:
// Send command
void DallasTemperature::beginCommunication(void)
{
  pDataWire->reset();
  pDataWire->select(arSlaveAddr);
  pDataWire->write(STARTCONVO,1);         // start conversion, with parasite power on at the end
  delay(1000);
}
41  Forum 2005-2010 (read only) / Syntax & Programs / Re: Function for multiple blinking LED instances on: June 29, 2009, 07:47:27 pm
Quote
The problem with the original post is that the 3 variables - state, ledON, ledOFF - need to be in an array.  The way you have it, each of the 3 pins are using the same variables, and it's messing things up.  I put together a corrected version, and even tried it, so I know it works

Arrrgh!!
Thanks, i was close from the beginning  :o

42  Forum 2005-2010 (read only) / Syntax & Programs / Re: Function for multiple blinking LED instances on: June 29, 2009, 07:24:58 pm
i'm trying this:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1245221219/1#1
43  Forum 2005-2010 (read only) / Syntax & Programs / Re: Function for multiple blinking LED instances on: June 29, 2009, 05:22:27 pm
I'm using struct now but i still unable to use only one function flashled(led_id) to pass argument of the led id i want to blink !!

I should never stop programming 22 years ago :-[

long time = 0;
typedef struct BlinkPin{
  byte ledpin;
  unsigned int ledON;
  unsigned int ledOFF;
  unsigned long timeON;
  unsigned long timeOFF;
  boolean state;
};

BlinkPin led1 = {10,25,1000,0,0,0};
BlinkPin led2 = {11,800,500,0,0,0};
BlinkPin led3 = {12,25,250,0,0,0};

void setup(){
  Serial.begin(38400);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
}

void loop(){
  flashled1();
  flashled2();
  flashled3();
}

void flashled1() {
  time = millis();
  if (led1.state == HIGH) {
    if (time >= led1.timeOFF) {
      led1.state = LOW;
      Serial.print(led1.state);
      digitalWrite(led1.ledpin, led1.state);
      led1.timeON = led1.timeOFF + led1.ledOFF;
    }
  }
  else {
    if (led1.state == LOW){
      if (time >= led1.timeON) {
        led1.timeON = millis();
        led1.state = HIGH;
        Serial.print(led1.state);
        digitalWrite(led1.ledpin, led1.state);
        led1.timeOFF = led1.timeON + led1.ledON;
      }
    }
  }
}

void flashled2() {
  time = millis();
  if (led2.state == HIGH) {
    if (time >= led2.timeOFF) {
      led2.state = LOW;
      Serial.print(led2.state);
      digitalWrite(led2.ledpin, led2.state);
      led2.timeON = led2.timeOFF + led2.ledOFF;
    }
  }
  else {
    if (led2.state == LOW){
      if (time >= led2.timeON) {
        led2.timeON = millis();
        led2.state = HIGH;
        Serial.print(led2.state);
        digitalWrite(led2.ledpin, led2.state);
        led2.timeOFF = led2.timeON + led2.ledON;
      }
    }
  }
}

void flashled3() {
  time = millis();
  if (led3.state == HIGH) {
    if (time >= led3.timeOFF) {
      led3.state = LOW;
      Serial.print(led3.state);
      digitalWrite(led3.ledpin, led3.state);
      led3.timeON = led3.timeOFF + led3.ledOFF;
    }
  }
  else {
    if (led3.state == LOW){
      if (time >= led3.timeON) {
        led3.timeON = millis();
        led3.state = HIGH;
        Serial.print(led3.state);
        digitalWrite(led3.ledpin, led3.state);
        led3.timeOFF = led3.timeON + led3.ledON;
      }
    }
  }
}


This should look like this :

flashled(led1);
flashled(led2);
flashled(led3);


void flashled(led_id) {
  time = millis();
  if (led_id.state == HIGH) {
    if (time >= led_id.timeOFF) {
      led_id.state = LOW;
      Serial.print(led_id.state);
      digitalWrite(led_id.ledpin, led_id.state);
      led_id.timeON = led_id.timeOFF + led_id.ledOFF;
    }
  }
  else {
    if (led_id.state == LOW){
      if (time >= led_id.timeON) {
        led_id.timeON = millis();
        led_id.state = HIGH;
        Serial.print(led1.state);
        digitalWrite(led_id.ledpin, led_id.state);
        led_id.timeOFF = led_id.timeON + led_id.ledON;
      }
    }
  }
}
44  Forum 2005-2010 (read only) / Syntax & Programs / Re: Function for multiple blinking LED instances on: June 29, 2009, 05:11:10 am
Quote
Without knowing what you want, I threw some code togehter. Might be helpful, might not. But I thing you could get an idea of how one way to implement this could look.

Alexander,

Thanks for the idea but i don't think i could do what i want with it. I may try indeed and i will. :smiley
Here's exactly my need:

1- The number of led can be more than 3 and i can deal with this code myself.

2- The blinking is the most important behaviour in the program and this is where i'm looking for help. Some led will lite up for 10 millis and snuff out for 800 millis or lite up for 200 millis and snuff out for 254 millis etc... anytime in the program. Values are between 15 millis and 5000 millis. It is purely for visual purpose monitoring.

3- I thought that a simple function would be enough for that multiple blinking behaviour.
45  Forum 2005-2010 (read only) / Syntax & Programs / Re: Function for multiple blinking LED instances on: June 29, 2009, 03:47:36 am
The code i first wrote for this example is this. You see the leds blinks with each states correctly. But my code is bad for a better overall program, i wish i could use only one function call instead.

long time = 0;
long timeON1 = 0; long timeOFF1 = 0; int state1 = LOW;
long timeON2 = 0; long timeOFF2 = 0; int state2 = LOW;
long timeON3 = 0; long timeOFF3 = 0;int state3 = LOW;

void setup()
{
  Serial.begin(38400);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
}

void loop()
{
  flashled1(10, 15, 400);
  flashled2(11, 150, 600);
  flashled3(12, 400, 1000);
}

void flashled1(int ledpin, int ledON, int ledOFF) {
  time = millis();
  if (state1 == HIGH) {
    if (time >= timeOFF1) {
      state1 = LOW;
      Serial.print(state1);
      digitalWrite(ledpin, state1);
      timeON1 = timeOFF1 + ledOFF;
    }
  }
  else {
    if (state1 == LOW){
      if (time >= timeON1) {
        timeON1 = millis();
        state1 = HIGH;
        Serial.print(state1);
        digitalWrite(ledpin, state1);
        timeOFF1 = timeON1 + ledON;
      }
    }
  }
}

void flashled2(int ledpin, int ledON, int ledOFF) {
  time = millis();
  if (state2 == HIGH) {
    if (time >= timeOFF2) {
      state2 = LOW;
      Serial.print(state2);
      digitalWrite(ledpin, state2);
      timeON2 = timeOFF2 + ledOFF;
    }
  }
  else {
    if (state2 == LOW){
      if (time >= timeON2) {
        timeON2 = millis();
        state2 = HIGH;
        Serial.print(state2);
        digitalWrite(ledpin, state2);
        timeOFF2 = timeON2 + ledON;
      }
    }
  }
}

void flashled3(int ledpin, int ledON, int ledOFF) {
  time = millis();
  if (state3 == HIGH) {
    if (time >= timeOFF3) {
      state3 = LOW;
      Serial.print(state3);
      digitalWrite(ledpin, state3);
      timeON3 = timeOFF3 + ledOFF;
    }
  }
  else {
    if (state3 == LOW){
      if (time >= timeON3) {
        timeON3 = millis();
        state3 = HIGH;
        Serial.print(state3);
        digitalWrite(ledpin, state3);
        timeOFF3 = timeON3 + ledON;
      }
    }
  }
}

Pages: 1 2 [3] 4 5