Show Posts
Pages: 1 2 3 [4] 5
46  Forum 2005-2010 (read only) / Syntax & Programs / Re: Function for multiple blinking LED instances on: June 29, 2009, 03:20:09 am
Brian,
I tried already earlier but i should look again into it now.
47  Forum 2005-2010 (read only) / Syntax & Programs / Re: Function for multiple blinking LED instances on: June 29, 2009, 03:18:19 am
The leds will start at different time in the program.
My loop() should look like this :

void loop()
{
 flashled(10, 1000, 500);
{some code here...}
 flashled(11, 500, 1000);
{some other code here...}
{some other code here...}
 flashled(12, 500, 500);
{some other code here...}
}
48  Forum 2005-2010 (read only) / Syntax & Programs / Function for multiple blinking led on: June 29, 2009, 02:06:36 am
I need help, i'm trying to blink multiple leds with one simple function within the .pde. Timer only, no delay.
I want two states for each led, millis ON and millis OFF. The code i did is not working like it suppose to.

void flashled(int ledpin, int ledON, int ledOFF)

I tried with an array and it did not work well either. Must be a simple way to get this works.

Thanks.

long time = 0;
long timeON = 0;
long timeOFF = 0;
int state = LOW;

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

void loop()
{
  flashled(10, 1000, 500);
  flashled(11, 500, 1000);
  flashled(12, 500, 500);
}

void flashled(int ledpin, int ledON, int ledOFF) {
  time = millis();
  if (state == HIGH) {
    if (time >= timeOFF) {
      state = LOW;
      //Serial.print(state);
      digitalWrite(ledpin, state);
      timeON = timeOFF + ledOFF;
    }
  }
  else {
    if (state == LOW){
      if (time >= timeON) {
        timeON = millis();
        state = HIGH;
        //Serial.print(state);
        digitalWrite(ledpin, state);
        timeOFF = timeON + ledON;
      }
    }
  }
}
49  Forum 2005-2010 (read only) / Syntax & Programs / Help with Parse split delimited string in c++ on: June 12, 2009, 06:02:11 pm
Hello everyone

How to make this code working in Arduino sketch ?

Quote
#include <string>
#include <vector>
#include <functional>
#include <iostream>
using namespace std;
void split(const string& s, char c, vector<string>& v) {
   string::size_type i = 0;
   string::size_type j = s.find(c);
   while (j != string::npos) {
      v.push_back(s.substr(i, j-i));
      i = ++j;
      j = s.find(c, j);
      if (j == string::npos)
         v.push_back(s.substr(i, s.length( )));
   }
}
int main( ) {
   vector<string> v;
   string s = "Account Name|Address 1|Address 2|City";
   split(s, '|', v);
   for (int i = 0; i < v.size( ); ++i) {
      cout << v << '\n';
   }
}
50  Forum 2005-2010 (read only) / Development / Re: Database Library on: July 26, 2009, 12:38:06 am
Very nice, thanks.
51  Forum 2005-2010 (read only) / Development / Re: Dallas Temperature Control Library released ;) on: August 08, 2009, 02:57:49 am
Excellent
52  Forum 2005-2010 (read only) / Français / Re: LED extérieure directement sur pin13 on: August 17, 2009, 02:14:25 am
Quote
On dit dans tous les documents que j'ai pu voir sur le net et même sur le site officiel que la sortie digitale 13 est spéciale dans le sens où on peut brancher directement une LED sans sa résistance de limiation d'intensité habituelle à cause de la résistance intégrée sur le circuit est servant aussi à la LED témoin

As-tu un lien sur ce que tu écris ?
Je ne savais pas. C'est étrange entoucas.
53  Forum 2005-2010 (read only) / Français / Re: Démarer un Arduino avec un pin on: August 07, 2009, 06:56:14 am
Ok pour les interruptions externes, je pensais bien que c'était ça. Je vais me concentrer là dessus !
Merci.
54  Forum 2005-2010 (read only) / Français / Démarer un Arduino avec un pin on: August 06, 2009, 06:24:44 am
J'ai un projet avec seulement un bouton. Il fait tout les fonctions que j'ai besoin, press/hold/press-press etc... ça c'est pas trop compliqué en utilisant les timers. Je veux aussi pourvoir démarrer/éteindre le Arduino avec ce même bouton, je ne sais pas comment m'y prendre. Probablement que le Arduino doit-être tout d'abord en sleep ou autre état de ce genre ?

Merci de me donner un petit coup de main.
55  Forum 2005-2010 (read only) / Bugs & Suggestions / [m by=mellis destboard=hardware dest=1249413028]: Piezo / buzzer without Arduino on: August 04, 2009, 02:40:28 pm
[moved] [link=http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1249413028/0]Interfacing[/link] [move by] mellis.
56  Forum 2005-2010 (read only) / Interfacing / Re: Piezo / buzzer without Arduino on: August 13, 2009, 01:42:17 am
My problem is acoustic!
I did put one of my many piezos in a small case with rubber around the piezo and it sound much better, warmer.  :smiley
57  Forum 2005-2010 (read only) / Interfacing / Re: Piezo / buzzer without Arduino on: August 12, 2009, 12:02:35 pm
Hey cool stuff there, i'm gonna need it for another project soon. But for now, i just need a simple beep sound but nice and warm, you know like the beep sound in your popular small electronic devices.
I wish i could use one Arduino PWM pin and trigger/modulate the 555 ic and produce a variety of nice beep sound on purpose.  :-/

Again, i can't use Arduino to produce the wave because he is already running other task and the wave sounds ugly that is why i need something external like the 555.
58  Forum 2005-2010 (read only) / Interfacing / Re: Piezo / buzzer without Arduino on: August 12, 2009, 06:43:12 am
Is there a way to hack the 555 to get a really nice beep sound from it. I tried many options, many piezos and i'm still not happy. I need a warmer beep sound. soft attack and release.
59  Forum 2005-2010 (read only) / Interfacing / Re: Piezo / buzzer without Arduino on: August 04, 2009, 02:40:28 pm
Thanks.
I found this helpfull infos : http://www.kpsec.freeuk.com/555timer.htm#astable
60  Forum 2005-2010 (read only) / Interfacing / Piezo / buzzer without Arduino on: August 04, 2009, 02:10:28 pm
I'm looking for a simple way to drive a Piezo/buzzer without the Arduino. I will trigger the piezo state (ON/OFF) from an Arduino digital pin but the square wave wont be generated by the Arduino. Is there a simple schematic out there for that ?

Thanks!
Pages: 1 2 3 [4] 5