Show Posts
Pages: [1] 2
1  Using Arduino / Project Guidance / IR remote on: July 22, 2013, 06:28:09 pm
Good night,
I have a problem and need to solve urgently.
The code should work, but is a problem in the library VirtualWire or IR Remote.
The first time the IR code is sent and the box changes channel, but as you enter the sub program receive when the IR code is sent again, no longer works.

If not using VirtualWire the code works fine, but the VirutalWire need to receive data from the rf.


I thank you



Quote
#include <VirtualWire.h>
#include <IRremote.h>

IRsend irsend;

int led = 13;
int code;
int device;
int toggle, old_toggle;

unsigned int channel[78] = {
  4550,4400,500,500,500,450,550,450,550,450,500,500,500,1450,500,450,550,450,550,450,500,500,500,450,550,450,550,450,500,500,500,450,550,450,500,4450,550,1400,550,450,550,400,550,450,550,450,500,500,500,1400,550,1450,500,450,550,450,550,450,500,500,500,1450,500,1450,500,450,550,450,500,1450,500,1450,500,1450,500,1450,500};

uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

void setup()
{
  Serial.begin(9600);
  pinMode(7,INPUT);
  pinMode(led, OUTPUT);
  // declarações

}

void loop()
{


  irsend.sendRaw(channel, 78, 38);
  delay(500);

  receber();

}



void receber(){
  
    vw_set_rx_pin(7); // Pino de recepção
  vw_set_ptt_inverted(true);
  vw_setup(2000);
  code = 0;
  device = 0;
  old_toggle = 2;
  vw_rx_start(); // Necessário para começar a receber informação

  if (vw_get_message(buf, &buflen)) // Caso chegue alguma mensagem ao receptor
  {
    code = atoi((char*) buf);

    device = (code & 0x7C0) >> 6;
    toggle = (code & 0x800) >> 11;
    code = code & 0x03F;

    if(toggle != old_toggle) {
      old_toggle = toggle; // Para nao repetir teclas


      //   Serial.println("\nToggle = " + String(toggle)); // Enviamos pela porta Serial o toggle
      //   Serial.println("Endereco = " + String(device)); // Enviamos pela porta Serial o endereco
      Serial.println("Codigo = " + String(code)); // Enviamos pela porta Serial o codigo
      memset( &buf, 0, sizeof(buf) ); // Fazemos reset à variável info para utilizar uma outra vez
    }
  }

  delay(100);
}

2  Using Arduino / Programming Questions / Re: sensor Pir on: June 29, 2013, 07:20:38 am
Good afternoon,
after studying a little more about sleep mode developed the following code which works without problem in ATMEGA328.
The problem is that the same code does not work on atmega8. Neither the led 13 when it sends the message.
I wanted to ask for help for this weird problem.


I thank you.
Quote
#include <avr/sleep.h>
#include <VirtualWire.h> // lib para RF

long tempofinal =0;
long prev = 0;   

int led = 13;
 int estado =0;



void setup()
{
pinMode(2, INPUT);
 pinMode(led, OUTPUT); 
 vw_set_tx_pin(9); // porta que vamos usar
 vw_setup(2000); // bits para comunicação
}

void loop(){
  enterSleep();
estado = digitalRead(2);
while( estado == HIGH){
  tempofinal =  millis() - prev ;
  estado = digitalRead(2);
  if (estado == LOW){
break;
 }
 if (tempofinal > 5000){
      prev = millis();
      pin2Interrupt();
}
}
  }
void pin2Interrupt(){
detachInterrupt(0); 
digitalWrite(led,HIGH);
for(float i=0;i<10000;i++){}
const char *msg = "3";
vw_send((uint8_t *)msg, strlen(msg));
digitalWrite(led,LOW);
}

void enterSleep()
{
  attachInterrupt(0, pin2Interrupt,RISING);
  delay(100);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN); 
  sleep_enable();                 
 sleep_mode();   
 
 sleep_disable();
}
3  Using Arduino / Programming Questions / Re: sensor Pir on: June 16, 2013, 12:25:22 pm
I try   attachInterrupt(0, pin2Interrupt, RISING); and attachInterrupt(0, pin2Interrupt, FALLING), but not work.

I tried a few that caught on google but could also not.

Its very important  for me to finish this part of the project.
4  Using Arduino / Programming Questions / sensor Pir on: June 16, 2013, 10:26:07 am
Good afternoon,

Have here a pir sensor detects movement when the wire has 4.80ve not detect when the thread is 0.06v.
It turns out that I wanted for the arduino to sleep, and when it detects movement up the Arduino wakes up.

Throughout the project I have the keypad to wake the Arduino. But I can not for the sensor to wake the Arduino.

My test code

Quote
#include <avr/sleep.h>
#include <VirtualWire.h> // lib para RF~

void setup()
{
    pinMode(13, OUTPUT);   
pinMode(2, INPUT);
digitalWrite(2, HIGH);
 vw_set_tx_pin(3); // porta que vamos usar
 vw_setup(2000); // bits para comunicação
}

void loop(){
digitalWrite(13, HIGH); 
delay(3000);
  enterSleep();
}

void pin2Interrupt(){

}

void enterSleep()
{
  digitalWrite(13, LOW);
  attachInterrupt(0, pin2Interrupt, LOW);
  delay(50);
  set_sleep_mode(SLEEP_MODE_PWR_DOWN); 
  sleep_enable();                 
  ADCSRA &= ~(1 << ADEN);
 sleep_mode();   
 detachInterrupt(0);
 sleep_disable();
}
5  Using Arduino / Project Guidance / Re: keypad sleep on: June 08, 2013, 02:24:52 pm
Good night
I managed to solve all my problems.
However I have seen here in the forum that it is possible for the keypad to wake the Arduino.
http://www.crossroadsfencing.com/Diode_AND_interrupt.jpg
Assembled according to the image with the 1N4007 diodes, but when I click on the keypad to arduino wake up, do not wake up.
If you use the button to have the part works.

thank a lot that can help me in this matter.


The code is attached.
6  Using Arduino / Project Guidance / keypad sleep on: June 07, 2013, 10:28:38 am
Good afternoon,

I'm learning to use sleep modes in arduino, but I have a problem I can not solve.
I have arduino, lcd shift register, and keypad.

Click on various number and when I click on the arduino 3 goes into sleep.
The problem is when I wake the Arduino it deletes the message from the screen, but the keypad does not work. I click on the numbers but does not appear on any screen.

I wonder what I'm doing wrong?



Quote
#include <ShiftLCD.h>
#include <Keypad.h>
#include <avr/power.h>
#include <avr/sleep.h>
int wakePin = 2;

ShiftLCD lcd(19, 17, 18);
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'D','#','0','*'},
  {'C','9','8','7'},
  {'B','6','5','4'},
  {'A','3','2','1'},
};
byte rowPins[ROWS] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {12, 11, 10, 9}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup()
{
   lcd.begin(16, 2);
  //setup the pushbutoon
  pinMode(wakePin, INPUT);
  digitalWrite(wakePin, HIGH);
 
  attachInterrupt(0, wakeUpNow, LOW);
}
void loop()
{
char key = keypad.getKey();

    if (key!= NO_KEY){
        lcd.print(key);
    if (key == '3' ){
          sleepNow();
        }
    }
}
   
void wakeUpNow()
{
 lcd.clear();

}
 
void sleepNow()
{
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    sleep_enable();
   sleep_cpu ();
    attachInterrupt(0,wakeUpNow, LOW);
    sleep_mode();
    sleep_disable();
    detachInterrupt(0);

}
7  Using Arduino / Interfacing w/ Software on the Computer / siemens c62 on: January 18, 2013, 11:00:34 am
Good afternoon,
I have a project to send messages with arduino, but the mobile phone siemens c45 died. I bought a siemens c62 ..

Now I did some tests with the hyperterminal with arduino but without the atmega inserted and can run several commands such as atd12045 read and send messages.

Happens that when connected with ATMEGA328 can send commands to it, but when I read a message appears in hyperterminal: Te% Õ? * Ÿ? Having ¥% ¥? Ê. But it must seem 6697DB6F7B990D ....

Have told me it could be baud rate, tried changing but always gives error.
AT + IPR =? result error
AT + IPR = error result 9600
Error result AT & W
at + baud5 result error

grateful for your help.
8  Using Arduino / Audio / arduino + siren on: March 15, 2012, 01:20:20 pm
Good afternoon,

I'm creating a home alarm, but I'm having difficulty to create a sound of an alarm.

I have 2x NE555 only can not I create a sound way.
 
or create something like http://www.youtube.com/watch?v=lu8MCtFWxwU&feature=youtu.be&t=31s http://youtu.be/VZVFfwz0cXQ?t=1m30s

I wanted to use this siren 12v
http://i00.i.aliimg.com/photo/v0/110335826/car_alarm_siren_horn_buzzer_speaker_120DB.jpg

someone can give help.
9  Using Arduino / General Electronics / keypad + arduino on: February 10, 2012, 10:14:37 am
Good afternoon,
I'm making a home alarm, and I want to connect a keyboard that I took a calculator.
I connect the keyboard so that I called just a port of Arduino.
I made this scheme works fine in proteus, but was wondering if there is no better way to do, or if not in practice is going to work.

thank you
10  Using Arduino / Networking, Protocols, and Devices / siemens + arduino on: January 23, 2012, 10:00:33 am
Did anybody ever connect a Siemens C45 (or similar Siemens mobile) to the Arduino  to send text messages using AT commands?

I've opened the mobile phone and soldered the wires as needed tx rx gnd connected with beadboard.

Anyone can give some tips, since I have no serial port on the laptop, and I do direct experience with the arduino.

1ºExperience.

connected with the tx --- rx  to rx  --  tx arduino and  serial monitor 19200 baud  and then I wrote the AT but the phone does not  respond
 Experiment also get the chip did not work.

I've seen comments that the phone work with at commands  with attiny

Thanks for your help!
11  Using Arduino / Displays / Re: lcd + arduino on: December 27, 2011, 06:03:28 pm
Good night

 I have a wireless doorbell and the column burned. So I did  some experiments with the led.
the button is touch the  doorbell I called  Arduino with  program turning on and off the LED.

At the doorbell where played music, plug the led  and  connect and worked turning on and off the LED

Then I managed to raise and lower the intensity of the LED.
  Now I wanted to connect the lcd.

I will also investigate the shift but at first glance are percise 3 wires
12  Using Arduino / Displays / lcd + arduino on: December 27, 2011, 10:19:37 am
Good afternoon,
I have a HD44780 LCD and an Arduino Duemilanove 2009, and wanted to try the following.

Arduino ----- to connect only one wire------- lcd

Thus it is impossible to know directly, wanted to know suggestions using integrated, so that that only one wire to connect arduino to send things to the lcd

arduino ------- to connect only one wire-------[Whatever it takes to work]   -----   lcd


thanks
13  Using Arduino / Project Guidance / smart card on: November 09, 2011, 01:39:54 pm
Good afternoon,

I have 4 cards of this type, and the arduino dualminove liked to read and write data on the cards.

I have one mounted the beadboard Adapters, and wanted to know what to do.

I have looked on google only appears RDFI and magnetic cards. Chip not found.

card: http://image.shutterstock.com/display_pic_with_logo/116533/116533,1237843802,2/stock-vector-closeup-of-smart-card-with-microchip-27217918.jpg
adapter: http://media.digikey.com/photos/CK%20Comp%20Photos/CCM02-1NO-32.jpg

14  Using Arduino / Programming Questions / Re: ultrsound arduino on: October 09, 2011, 09:49:23 am
Good afternoon,
From what I understand of all the tutorials I saw on google, it always used the circuit board, and links to the arduino only one wire.

In the scheme of post that I have a 2 wire is connected to the Arduino and 1  pwm  2 to pulse.

I think the problem ping the tutorial is missing part of the PWM, or is not it.
15  Using Arduino / Programming Questions / Re: ultrsound arduino on: October 09, 2011, 08:04:30 am
Good afternoon,

I auditioned with the doors 4 and 5 of arduino and get the same problem
Pages: [1] 2