Recent Posts

Pages: [1] 2 3 ... 10
1
Project Guidance / Re: CDI tester project
Last post by cattledog - Today at 03:11 am
Can you scope the output from the Arduino and confirm that it is what you want before connecting to all the other hardware down stream? I'd like to try and separate any software issues from subsequent hardware issues.
2
Sensors / Re: Touch area fingerprint
Last post by jackthom41 - Today at 03:08 am
Yeah you can find such hardware and its called new bigger Capacitive Touch Sensor. It will be a little costly than what you already have. :P
3
Programming Questions / Re: RFID card credit system
Last post by sj729 - Today at 03:00 am
Thank you for your reply, Delta_G!


I did some research and came up with this:

Code: [Select]

for (uint8_t i = 0; i < 16; i++)
          {
            if (buffer[i] != 32)
            {
              Serial.write(buffer[i]);           
            }
            byte tamt = amt + (buffer[i]);   


I am new to parsing, as you can probably tell, so please bear with me.
Would this work? Thank you for your support,

Samuel Johnson
4
Project Guidance / Re: CDI tester project
Last post by tom_bauer - Today at 03:00 am
OK, I have some parts on order and need to wire it up so it may be a few days. Thanks, I will keep in touch.
Tom
5
Programming Questions / Re: newbee needs help
Last post by Blackfin - Today at 02:56 am
Part 2/2

OP, sorry I didn't have time to comment it. PM me if you have any questions.

Code: [Select]

 
void loop()
{
    StartStopStateMachine();
   
    if( ActiveProcedure != NULL )
        (*ActiveProcedure)();

    BlinkLED();
   
} // close void loop

void BlinkLED( void )
{
    static int
        stateLED = LOW;
    static unsigned long
        timeAliveLED = millis();
    unsigned long
        timeNow;

    timeNow = millis();
    if( (timeNow - timeAliveLED) > 250ul ) 
    {
        stateLED ^= HIGH;
        digitalWrite( pinHeartBeatLED, stateLED );

        timeAliveLED = timeNow;
    }//if

}//BlinkLED

void start_proceduren( void )
{
    static unsigned long
        timeStart;
    static byte
        stateStart = START_1;
       
    switch( stateStart )
    {
        case    START_1:
            Serial.println( "START PROCEDURE:" );
            digitalWrite(gloeispiraal, LOW);
            Serial.println( "   - Glow Plug LOW" );//Serial.print(gloeispiraal);
            digitalWrite(brandstofpomp, LOW);
            Serial.println( "   - Fuel Pump LOW" );//Serial.print(brandstofpomp);
            digitalWrite(luchtklep, LOW);
            Serial.println( "   - Air Valve LOW" );//Serial.print(luchtklep);
            timeStart = millis();
            stateStart = START_2;
           
        break;

        case    START_2:
            if( (millis() - timeStart) > 120000ul )     //120000    2-minutes
            {
                digitalWrite(ventilator, LOW);
                Serial.println( "   - Ventilator LOW" );//Serial.print(ventilator);
                stateStart = START_1;
                Serial.println( "START PROCEDURE COMPLETE\n" );
                ActiveProcedure = NULL;
                               
            }//if
           
        break;
       
    }//switch
       
}//start_proceduren


void stop_proceduren()
{
    static unsigned long
        timeStop;
    static byte
        stateStop = STOP_1;
       
    switch( stateStop )
    {
        case    STOP_1:
            Serial.println( "STOP PROCEDURE:" );
            digitalWrite(ventilator, HIGH);
            Serial.println( "   - Ventilator HIGH" );//Serial.print(ventilator);
            timeStop = millis();
            stateStop = STOP_2;
        break;

        case    STOP_2:
            if( (millis() - timeStop) > 5000ul )
            {
                digitalWrite(gloeispiraal, HIGH);
                Serial.println( "   - Glow Plug HIGH" );//Serial.print(gloeispiraal);
             
                digitalWrite(luchtklep, HIGH);
                Serial.println( "   - Air Valve HIGH" );//Serial.print(luchtklep);
                timeStop = millis();
                stateStop = STOP_3;
               
            }//if
           
        break;

        case    STOP_3:
            if( (millis() - timeStop) > 16000ul )
            {
                digitalWrite(brandstofpomp, HIGH);
                Serial.println( "   - Fuel Pump HIGH" );//Serial.print(brandstofpomp);
                timeStop = millis();
                stateStop = STOP_4;
               
            }//if
           
        break;

        case    STOP_4:
            digitalWrite(gloeispiraal, LOW);
            Serial.println( "   - Glow Plug LOW" );//Serial.print(gloeispiraal);
            Serial.println( "STOP PROCEDURE COMPLETE\n" );
            stateStop = STOP_1;
            ActiveProcedure = NULL;
           
        break;
       
       
    }//switch
   
}//stop_proceduren

void error_proceduren()
{
  Serial.println("*** Error: Unknown button press ***\n\n");
 
}//error_proceduren
6
Quote
Is there any reason not to use the Arduino IDE from the command line?
I don't think it gives you the features that the OP was hoping to get from Make.   Though I'm not sure what those are, exactly...
Quote
For simplicity, let's assume that all of the source files are located in the current directory.
Quote
Also, there is a main.c file which contains the actual entry point and no further pre-processing needs to be done
Neither of which is the normal case.  Source is scattered across at least three directories, and possibly many more (when core libraries, arduino libraries, and user-installed libraries are all in use.)  And there is complicated pre-processing that figures out exactly which include paths to used based on simple #include statements, board type, and ... searching of those many library locations...

Quote
Here's how the suggestion looks like in detail:
The Arduino IDE creates a scratch directory and copies the core modules and libraries into that directory
That doesn't sound very efficient.  It's on the order of 100 files...

Quote
The Arduino IDE performs additional preparation steps such as adding #include statements and creating the actual main.c file based on the scratch
main.c already exists.  The #include statements already exist.  What the pre-processing does is compute paths for the compile command ("-Ixxxx") and prototypes for user functions in the .ino files.
Quote
The Arduino IDE generates a Makefile which builds all of the source files (core, libraries, sketch) and the HEX file. The Makefile should have two targets: "compile" and "program". Those targets are linked to the buttons "verify" and "upload" in the IDE.
Bah.  If you have to generate a Makfile every time you do a build, it's definitely not worth it!


Quote
[existing makefiles] have way too many config options
This is something that tends to be true of Makefiles in general.   :-(

Quote
Why do I need this? I would like to do different builds for testing (on the host machine) as well as production (the microcontroller target).
Ah.  "IOU" for Arduino.  I've considered that a couple of times...
So in fact the changes you are suggesting won't even fulfill your requirement - they'll just get you closer to something that you can easily modify...

I THINK what you're trying to do could be done relatively readily just by creating a new "platform", which is documented... (see https://forum.arduino.cc/index.php?topic=457405.0 )   Much more easily that going to a make-based system, anyway.
(Well, you could could have Make run the "arduino cli", but that probably doesn't do what you want.)

7
Programming Questions / Re: newbee needs help
Last post by Blackfin - Today at 02:55 am
I don't know what you want to do with "error locking" but here's something that seems to work on the serial console.

Warning: Not fully debugged. Use at your own risk. YMMV. etc etc

Part 1/2 (forum size limit; just copy paste them together...)

Code: [Select]
#define START_1     0
#define START_2     1

#define STOP_1      0
#define STOP_2      1
#define STOP_3      2
#define STOP_4      3

#define NUM_PROCEDURES              2

#define WAIT_FOR_BUTTON_RELEASE     0
#define WAIT_FOR_BUTTON_PRESS       1
#define TIME_BUTTON_RELEASE         2
#define WAIT_FOR_PROCEDURE          3
#define TIME_DEADTIME               4

void start_proceduren( void );
void stop_proceduren( void );

typedef void (*ProcFunc)();

typedef struct
    {
        unsigned long   minPress;
        unsigned long   maxPress;
        unsigned long   deadTime;
        ProcFunc        Func;
    }ProcedureTableStruct;

ProcFunc
    ActiveProcedure = NULL;
   
ProcedureTableStruct
    ProcTable[] =
        {
            {
                .minPress = 100ul,
                .maxPress = 600ul,
                .deadTime = 5000ul,             //5-seconds
                .Func = &start_proceduren
            },
            {
                .minPress = 2000ul,
                .maxPress = 2500ul,
                .deadTime = 10000ul,            //10-seconds
                .Func = &stop_proceduren
               
            }
        };

float pressLength_milliSeconds = 0;
 
// Define the *minimum* length of time, in milli-seconds, that the button must be pressed for a particular option to occur
int optionOne_milliSeconds = 100;
int optionTwo_milliSeconds = 2000;       

// Define error counter
int error = 0;
 
//The Pin your button is attached to
const int startstop = 6;
const int reset = 7;
const int vlamschakelaar = 8;
const int tempschakelaar = 9;
 
//Pin your LEDs are attached to
const int pinHeartBeatLED = 13;
const int ventilator = 5;
const int gloeispiraal = 4;
const int luchtklep = 2;
const int brandstofpomp = 3;
const int volhalfvermogen = 10;
 
void setup()
{
    // Initialize the pushbutton pin as an input pullup
    // Keep in mind, when pin 2 has ground voltage applied, we know the button is being pressed
    pinMode(startstop, INPUT_PULLUP);     
    pinMode(reset, INPUT_PULLUP);
    pinMode(vlamschakelaar, INPUT_PULLUP);
    pinMode(tempschakelaar, INPUT_PULLUP);
 
    //set the stuur pins as outputs
    pinMode(ventilator, OUTPUT);
    pinMode(gloeispiraal, OUTPUT);
    pinMode(luchtklep, OUTPUT);
    pinMode(brandstofpomp, OUTPUT);
    pinMode(volhalfvermogen, OUTPUT);
    pinMode(pinHeartBeatLED, OUTPUT);
    digitalWrite( pinHeartBeatLED, LOW );

    //Start serial communication - for debugging purposes only
    Serial.begin(9600);                                     
 
} // close setup

void StartStopStateMachine( void )
{
    bool
        procMatched;
    byte
        i;
    int
        nowBtn,
        lastBtn;
    static unsigned long
        timeDeadTimeDelay,
        timeButtonStart;
    unsigned long
        timeButtonPressed;
    static byte
        stateSSSM = WAIT_FOR_BUTTON_RELEASE;

    switch( stateSSSM )
    {
        case    WAIT_FOR_BUTTON_RELEASE:
            if( digitalRead( startstop ) == HIGH )
                stateSSSM = WAIT_FOR_BUTTON_PRESS;
                       
        break;

        case    WAIT_FOR_BUTTON_PRESS:
            if( digitalRead( startstop ) == LOW )
            {             
                delay(10);
                if( digitalRead( startstop ) == HIGH )
                    stateSSSM = WAIT_FOR_BUTTON_RELEASE;
                else
                {
                    timeButtonStart = millis();
                    stateSSSM = TIME_BUTTON_RELEASE;
                }//else
            }//if
        break;

        case    TIME_BUTTON_RELEASE:
            if( digitalRead( startstop ) == HIGH )
            {
                timeButtonPressed = millis() - timeButtonStart;
                i=0;
                procMatched = false;
                do
                {
                    if( (timeButtonPressed >= ProcTable[i].minPress) &&
                            (timeButtonPressed <= ProcTable[i].maxPress) )
                    {
                        ActiveProcedure = ProcTable[i].Func;
                        timeDeadTimeDelay = ProcTable[i].deadTime;
                        stateSSSM = WAIT_FOR_PROCEDURE;
                        procMatched = true;
                                                   
                    }//if

                    i++;
                   
                }while( i<NUM_PROCEDURES && !procMatched );
               
                if( !procMatched )
                {
                    error_proceduren();
                    stateSSSM = WAIT_FOR_BUTTON_RELEASE;
                   
                }//if
               
            }//if
           
        break;

        case    WAIT_FOR_PROCEDURE:
            if( ActiveProcedure == NULL )
            {
                timeButtonStart = millis();
                stateSSSM = TIME_DEADTIME;
               
            }//if
       
        break;
       

        case    TIME_DEADTIME:
            if( (millis() - timeButtonStart) >= timeDeadTimeDelay )
            {
                Serial.println( "READY FOR ANOTHER COMMAND\n" );
                stateSSSM = WAIT_FOR_BUTTON_RELEASE;
               
            }//if
           
        break;

        default:
            stateSSSM = WAIT_FOR_BUTTON_RELEASE;
        break;
               
    }//switch
   
}//StartStopStateMachine
8
Storage / Re: SD card broken?
Last post by Lucario448 - Today at 02:52 am
It reads fine, but when it reaches a quote, it doesn't know what to do. I think that's because strings have to have \' in order to make it display a quote. When it has (char)myFile.read(); it might read the backslash and put an extra \ in the name.
Nonsense. You use escape characters (aka backslashes \) when hard-coding strings, there's no problem in building a string, in runtime, with quotation marks and without escapes; even backslashes alone aren't an issue either.

Escape characters in strings only matter for the compiler, not for the running program.


Another thing I've noticed is that google docs and word use Non-ASCII based symbols for the " and ' symbols. I have recently had to delete and re-create lots of the text documents.
The library actually treats files as binary, so this is why is important to use only plain text and not more sophisticated encodings such as docx, PDF, etc. It also expects standard ASCII text, thus anything else like extended ASCII and Unicode, may lead to data misinterpretation.
9
Français / Re: (Résolu) Aide pour projet ...
Last post by Col68 - Today at 02:51 am
Salut les amis

Comme promis voici des images du résultat final. N'ayant pas pu trouver un condo 10000uf j'ai utiliser l'adaptateur 32V et un module LM317.



L'alim principale de 31.6V stable vers LM2596, transformer à 24V. Double sorties depuis le LM2596, 1 vers l'IRF520= +24V vers le hakko, le second vers le LM317= +5V Nano et modules.





J'espère que ça fonctinnera, merci infiniment pour votre aide, vous souhaitant que du bonheur

Cordialeme.
10
Quote
the transceiver on the Pro Mini is wired to its RX/TX pins
It won't work to use those pins for the serial monitor and a transceiver at the same time, so how are you handling that?

The posted code should not compile for a Pro Mini, because it lacks Serial1.
Pages: [1] 2 3 ... 10