Recent Posts

Pages: [1] 2 3 ... 10
1
Quote
this function inside the loop only check if the timer needs to be turn ON or OFF continuously,
Then startsstimer is surely a silly name for the function. updatesstimer or checksstimer might have been a better choice.
2
Français / Re: Programmation d'un affiche...
Last post by icare - Today at 10:02 am
Bonjour,
Les caractères <32 ne sont pas utilisés pour l'affichage.
Ces caractères sont interprétés par l'afficheur.
Par exemple : chr$(0) = header, chr$(1) = afficheur 1 line, etc... +1 pour la doc
3
Français / Re: arduino bug sur secteur, b...
Last post by 68tjs - Today at 10:01 am
Le régulateur de la carte est prévu pour alimenter la carte et quelques petits accessoires pas trop gourments en courant. Si on lui en demande trop il chauffe et la tension délivrée s'effondre.
L'USB est, elle, prévue pour délivrer jusqu'à 500 mA.

Avec tous les mA consommés il faut une alim 5V supplémentaire. Alim 5V +/- 5%, avec le 0V relié à celui de la carte arduino. C'est a dire les masses reliées ensembles.

PS ce serait plus facile pour nous si au lieu de donner le schéma de câblage tu donnais le schéma électrique : il y a une option dans Fritzing qui le fait.
4
Arduino Yún / Update arduino from website
Last post by jl-p - Today at 10:00 am
Is there a way to download the arduino code hex file from a website to update the yun arduino site.

Kind regards

Johan
5
Quote
I want to blink LED's like a police car. For fun and to learn. Such as headlights that go back and forth and red and blue lights that blink fast and then even a set of strobes that blink fast as well, but not as fast as the red and blue's but faster than the headlights. If you wanted to go full meal deal then another set that strobe as weill in a pattern (the ambers)
Have a look at Several things at the same time
6
Hi UKHeliBob,

this function inside the loop only check if the timer needs to be turn ON or OFF continuously, that's all it needs.

see also the library #include <sstimer.h> download the library from the link.

Code: [Select]
void loop(){
//...
WATER_PUMP.startsstimer();
LIGHTHING.startsstimer();
//.. 
}
7
Programming Questions / Re: PWM help
Last post by nicoverduin - Today at 09:58 am
I find it a bit strange that a thermistor is used unless it is some kind of RC circuit that generates a variable voltage.
I could not resist: :smiley-mr-green: I haven't test it yet but you can give it a try on the scope...
Code: [Select]

/**
 * @file    fanControl.ino
 * @author     Nico Verduin
 * @date      31-1-2015
 *
 * @mainpage fanControl
 * PWM control with fixed Toff and variable Ton
 *
 *
 * @par License info
 *
 * Variable PWM motor control.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Program : fanControl
 * This is free software, and you are welcome to redistribute it.
 *
 */
//
// includes
//
#include "Arduino.h"
//
// Pin definitions
//
#define PWM_PIN       5                  // you can use any digital pin in this case
#define POTMETER      A0                 // we will use A0 as potentiometer
//
// global defines & parameters
//
#define TOFF          700                // Toff = 700 micro seconds
#define TON_10        80                 // 10% speed is about 80 micro seconds
#define TON_50        700                // 50% speed is about 700 micro seconds
#define TON_90        6300               // 90% speed is about 6300 micro seconds
#define MINIMALPOT    50                 // if potmeter below this level turn motor off
//
// global variables
//
unsigned long         timer;             // timer to flip the pulse
unsigned long         switchTime;        // moment to flip the next time
/**
 * @name setup()
 * initialize the program
 */
void setup()
{
    pinMode(PWM_PIN, OUTPUT);            // IO port
    digitalWrite(PWM_PIN, LOW);          // Turn motor off
    timer = 0L;                          // turn timer off
}

/**
 * @name loop()
 * main loop of program and runs endlessly
 */
void loop()
{
    unsigned long      currentTime;      // contains the current micros time
    uint8_t            level;            // current level of PWM pin
    uint16_t           analogValue;      // value from potmeter
    //
    // test timer if we have to flip. If zero no testing is done as motor is
    // turned off
    //
    if (timer != 0 ) {
        //
        // get the current micros time
        //
        currentTime = micros();
        //
        // the timer is set so test depending on lOW or High time
        //
        level = digitalRead(PWM_PIN);
        if (level) {
            //
            // we are in the HIGH part of the pulse
            //
            if ((currentTime - timer) > switchTime){
                //
                // we have to flip from HIGH to LOW
                //
                digitalWrite(PWM_PIN, LOW);
                //
                // set the timer for next time
                //
                timer = currentTime;
            }
        } else {
            //
            // we are in the LOW part of the pulse
            //
            if ((currentTime - timer) > TOFF) {
                //
                // we have to switch from LOW to HIGH
                //
                digitalWrite(PWM_PIN, HIGH);
                //
                // set the timer for next time
                //
                timer = currentTime;
            }
        }
    }
    //
    // read the potmeter and determine high pulse duration
    //
    analogValue = analogRead(POTMETER);
    //
    // test if we want to switch off
    //
    if (analogValue < MINIMALPOT) {
        //
        // switch the motor and timer off
        //
        digitalWrite(PWM_PIN, LOW);
        timer = 0L;
    }
    //
    // map potmeter value to a pulse width value
    //
    switchTime = map(analogValue, MINIMALPOT, 1023, TON_10, TON_90);
}

8
Code: [Select]
void loop(){
//...
WATER_PUMP.startsstimer();
LIGHTHING.startsstimer();
//.. 
}
Start the timers each time trough loop()
Is that right ?
9
Quote
The code's came with the site
What code would that be ?

Read this before posting a programming question
10
Français / Re: problème librairie temps
Last post by icare - Today at 09:56 am
Bonjour,
En +, il y a ceci :
Code: [Select]
 if( reveille = 1) //les instructions a mettre apres le reville
qu'il faut remplacer par :

Code: [Select]
 if( reveille == 1) //les instructions a mettre apres le reville
Pages: [1] 2 3 ... 10

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy