Recent Posts

Pages: 1 ... 6 7 [8] 9 10
71
An Arduino library?

Why?

Perhaps you should think about learning C++ if you want to use the Arduino.

72
Project Guidance / Re: Using 2 interrupts
Last post by Jeffro_Aus - Today at 02:30 am
I decided to change my approach a little and use Pin Change Interrupts for D2 and D3. I've modified the code to allow for this.

How does this look now? (i need it to be very reliable)

Code: [Select]
#include <avr/sleep.h>                  
#include <avr/power.h>
#include <avr/wdt.h>

volatile int pressed = 0;

void setup()
{
    // put your setup code here, to run once:
    Serial.begin(9600);
    Serial.println("starting...");
    delay(100);
    
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    
    // pin change interrupt
    PCMSK2 |= bit (PCINT18)| bit (PCINT19);  // want pin D2 and D3
    PCIFR  |= bit (PCIF2);   // clear any outstanding interrupts
    PCICR  |= bit (PCIE2);   // enable pin change interrupts for D0 to D5
    
    //enable watchdog to check for code lockups
    wdt_enable(WDTO_8S);
}


  
ISR (PCINT2_vect)
{
   // handle pin change interrupt for D2/D3
   pressed = 1;
}  


void sleepNow ()
{  
    wdt_disable();

    set_sleep_mode (SLEEP_MODE_PWR_DOWN);   // sleep mode is set here
    byte adcsra_save = ADCSRA;
    ADCSRA = 0;  // disable ADC
    power_all_disable ();   // turn off all modules
    sleep_enable();
    sleep_cpu ();            // now goes to Sleep and waits for the interrupt
    sleep_disable();
    ADCSRA = adcsra_save;  // stop power reduction
    power_all_enable ();   // turn on all modules
}  


void loop()
{
    // put your main code here, to run repeatedly:

    //reset watchdog timer
    wdt_reset();
  
    //print if button pressed
    if (pressed == 1)
    {
      pressed = 0;
      Serial.println("pressed");
    }

    //do something useful here

    
 
    delay(100);
    sleepNow();
}



Thanks
73
Deutsch / Re: Frage zu HM-10 / HC-06 Blu...
Last post by Scherheinz - Today at 02:29 am
Das funktioniert auch über WLAN, hab ich auch hier im Forum schon bei jemandem gesehen.....
75
Don't keep repeating yourself. What motor? What Arduino? What button? Try to give us a bit of information, we aren't mind-readers.
76
i just tried
Code: [Select]
float dtostf(); and doesn't work, looks like i will never understand where to put it in the code. I have no clue how to call dtostf with float... thank you for your time anyway. :(
77
The EID number looks like this: 982_000175197588, and the visual number on the tag is like this:
UK9 371177 0800 5.
Are these actual numbers from a particular tag or "like" the numbers? Can you please post actual numbers?

According to the datasheet:

Quote
The output format for a read of an EM4100 transponder is a simple string of 10 ASCII coded Hexidecimal characters followed by the ASCII code $0D (carriage return) as a string end marker.
Thus I would expect to see some numbers in the range A to F (in addition to 0 to 9), and not to see an underscore. I also expect to see 10 of them, and not some other number.
78
Displays / Re: how to connect ldr with ar...
Last post by bodmer - Today at 02:23 am
The resistor on the right is for the LED backlight, if you do not need a backlight (illuminated display) then you can omit that.

The LCD contrast pin is trickier to eliminate as a bias voltage is needed between 0V and 5V to set the contrast and this is normally set by a potentiometer (pot) or one/two resistors. Some success has been achieved using a PWM pin.

It might also be possible to use the Arduino UNO AREF pin as bias source since the voltage on this pin can be set by changing the reference, eg:

analogReference(INTERNAL1V1);

But the that pin is not really designed to sink even a small current, the contrast might not be ideal and it will mess up the analogue measurements!

Some LCDs are readable with the contrast pin connected to 0V, others like a bias level of about 0.5V.

Caveat: I have not tried any of this myself. Pots (or a single "select on test" bias resistor to 0V) are cheap and is the correct solution so why not use one!

79
Deutsch / Re: Rennsimulator Button Box H...
Last post by Scherheinz - Today at 02:17 am
Ja oder ich montiere sie nur dort wo ich sie auch brauche, für das Geld unschlagbar
80
Microcontrollers / Re: External interrupt on Atme...
Last post by Whandall - Today at 02:17 am
And the GND of the Arduino is connected to the GND of the power supply?
Pages: 1 ... 6 7 [8] 9 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