Show Posts
Pages: 1 2 [3] 4 5 ... 23
31  Using Arduino / Programming Questions / Re: help with alarm code on: March 14, 2013, 08:57:04 am
this is my code but i doesnt compile, i cant find the error...

Code:
#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

int LedState=LOW ;
// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("YOUR-TOKEN-HERE");

// Message to post
char* msg[20];
char str1[]="post one";
char str2[]="post two";
char str3[]="post three";
char str4[]="post four";
char str5[]="post five";
char str6[]="post six";

void setup()
{
  digitalWrite(2, HIGH);
  attachInterrupt(0, alarm, RISING);
 
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
 
 

void loop()

 int count=0;
  if (ledState == HIGH)
  {
    LedState==LOW;
   
    Swtich (count)
    { case 1:
    msg =& str1;
    count++;
    break
   
    case 2:
    msg =& str2;
    count++;
    break
   
    case 3:
    msg =& str3;
    count++;
    break
   
   
    case 4:
    msg =& str4;
    count++;
    break
   
    case 5:
    msg =& str5;
    count++;
    break
    case 6:
    msg =& str6;
    count=0;
    break;
    }
     }
   
   
   
   Serial.println("connecting ...");
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }

 
  }



 void alarm()
 {
  ledState = HIGH;
   
 }
32  Using Arduino / Programming Questions / Re: help with alarm code on: March 13, 2013, 07:48:53 am
i dont need the serial monitor, but, the problem its that until i dont open the serial monitor arduino wont post anything....


and sorry for my ignorance, but why would i need a debounce?? i just need to recognize the change of state on the pin, so if it bounce, until only post one msg its ok for me....

and for the twitter error for posting the same msg i think that using a counter and 5 different msgs in a switch sentence, and the variable
Code:
char msg[]
should be declared as a pointer...

do u think this make any logic???, if so later this day i will post a program to do that...

also thanks for your help it really helps me a lot
33  Using Arduino / Programming Questions / Re: help with alarm code on: March 12, 2013, 08:35:35 am
thanks everyone for the help, i will try more a little late.

And for the variable char msg.... the lib of this code has tobe declared as char.... maybe i can post millis()... but i will have to study that
34  Using Arduino / Programming Questions / Re: help with alarm code on: March 12, 2013, 07:21:47 am
Try this out there is no debounce of the pin Interrupt 0 is digital pin 2 on the Uno baord
Code:
#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

//const int ledPin = 3;
int ledState = LOW;

// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("1220261654-BPUYlMFTyfs5ooSFSA62C57Ujeqnr9hdn7PARZm");
// you shouldn't post your token we could post on your Twitter account with this info...

// Message to post


void setup()
{
  digitalWrite(2, HIGH); //turn on internall pullup resistor
  attachInterrupt(0, ExtInt0Fall, FALLING); // there is no debouce of this pin
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  Serial.println("connecting ...");
  char msg[]="que odes";
}

void loop()
{
  if (ledState == HIGH)
    {
      ledState = LOW;//[color=red]this turns the led off???[/color]
      int cont=0; // ? what is this for??//[color=red]this was meant tobe a counter to print it with the msg so the msg could change and twitter did not give error[/color]
      Serial.println("High now");   
      delay(1000);
      if (twitter.post(msg))
        {
          // Specify &Serial to output received response to Serial.
          // If no output is required, you can just omit the argument, e.g.
          // int status = twitter.wait();
          int status = twitter.wait(&Serial);
          if (status == 200)
            {
              Serial.println("OK.");
            }
          else
            {
              Serial.print("failed : code ");
              Serial.println(status);
            }
        }
      else
        Serial.println("connection failed.");
    }
}

void ExtInt0Fall()
{
  ledState = HIGH;


the problem im still trapped its that still the code post only when i open the serial monitor in the IDE, only that this time it waits untill the led turns on.... but its possible to change that i don need to open the serial port???... i dont need any status msg on serial monitor, i mean the arduino will never be connected to a computer to run this program.....
35  Using Arduino / Programming Questions / Re: help with alarm code on: March 11, 2013, 02:31:18 pm
i know how to do that, the problem is that i cant change how to post a msg without opening the serial port
36  International / Español / arduino twitter alarma on: March 11, 2013, 02:27:49 pm
Buenas a todos y bueno sigo trasteando el ethernet shield y encontre como hacer post con el twitter que me parecio muy interesante, el problema es que quiero que el arduino haga un tweet cada vez que un pin cambie de estado LOW a HIGH, ahora el problema es que el programa que encontre aqui publica un tweet cada vez que abro el puerto serial mendiante el IDE de arduino, por lo cual en mi muy basica experiencia no he logrado cambiarlo, lo segundo es que twitter no me deja hacer el mismo tweet 2 veces por lo que reconoce es un mensaje duplicado, alguien que tenga experiencia en esto que me puead dar un pequeño empujon??

el codigo que uso es el basico

Code:
#if defined(ARDUINO) && ARDUINO > 18   // Arduino 0019 or later
#include <SPI.h>
#endif
#include <Ethernet.h>
//#include <EthernetDNS.h>  Only needed in Arduino 0022 or earlier
#include <Twitter.h>



byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 10, 0, 0, 177 };
Twitter twitter("<<< mi token>>>");
char msg[] = "mi mensaje";

void setup()
{
  delay(1000);
  Ethernet.begin(mac);
  Serial.begin(9600);
  
  Serial.println("connecting ...");
  if (twitter.post(msg)) {
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }
}

void loop()
{
}
37  Using Arduino / Programming Questions / Re: help with alarm code on: March 09, 2013, 08:57:04 pm
i still have no posted the changes that NIck suggested....


38  Using Arduino / Programming Questions / Re: help with alarm code on: March 09, 2013, 05:01:38 pm
so if i attacht it to an interrupt and read the rising, the arduino will know that, i see that error, thanks, but how can i change that arduino knwos that state and post the msg without open the serial monitor???
39  Using Arduino / Programming Questions / help with alarm code on: March 09, 2013, 04:51:47 pm
hi all...

i just foun this code but maybe im not editing it right....

what i want with the code its ust to simple post a tweet every time my led turns high....

but have many troubles, for example the code just post when i open serial monitor, second when i change the code for the led input, then it doesnt post anything,
and last, its that twitter does not acept my msg cos it said its the same tweet, so how can i change that

Code:
#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

const int ledPin = 3;
int ledState = LOW;

// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
byte ip[] = { 192, 168, 2, 250 };

// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("1220261654-BPUYlMFTyfs5ooSFSA62C57Ujeqnr9hdn7PARZm");

// Message to post


void setup()
{
 
  pinMode(ledPin, INPUT);
  delay(1000);
  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
 
  Serial.println("connecting ...");
 
}

void loop()
{
 
  Serial.println(ledState);
  char msg[]="que odes";
  if (ledState == HIGH)
  {
 
  int cont=0;
  delay(1000);
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
   
   
  }
  }
}
40  Using Arduino / Project Guidance / help to tweet via arduino on: March 07, 2013, 09:49:52 pm
hi all, i just want to know if there any way to post a tweet via arduino and a ethernet shield, if someone has an example would be better
41  International / Español / Re: encender leds secuencialmente on: March 04, 2013, 06:32:51 pm
si eso he visto, pero bueno el problema es que eso aqui en mi pais, ummm esta imposible lo pedire por ebay a ver como queda junto con unos 1500 pies de fibra optica..... y algunos led de alta emsion para ir probando
42  International / Español / Re: encender leds secuencialmente on: March 04, 2013, 05:59:09 pm
ummmmm interesante, al igual hay que conseguir el convertidor serie paralelo.... porque yo iba pensando en un decade counter
43  International / Español / Re: encender leds secuencialmente on: March 04, 2013, 03:55:07 pm
@fm con un registro de desplazamiento??? ummm la verdad ando perdido con eso, si me puedes explicar un poco mas...

@tazma los compras en ebay pero debes buscar los que son de final brillando o end glow... valen cerca de 5 dolares unos 50 pies
44  International / Español / encender leds secuencialmente on: March 04, 2013, 11:57:40 am
hola a todos, veran tengo unas dudas de algo que me intereso, pero quiero saber si hay alguna forma de encender una fila de leds secuencialmente usando solo un pin de arduino, osea si tengo 10 leds en linea, que primero encienda uno y luego otro y asi sucecivamente, creo que es imposible solo con el arduino, pero algun hardware como algun CMOS o algo asi que me pueda ayudar...

lo que quiero ahcer es un cielo estrellado con leds y fibra optica, pero quiero que los leds se enciendan secuencialemente para simular una lluvia de estrellas.....

aun no tengo nada, solo la idea en mente, pero quiero comprar la fibra esta semana para comenzar a trabajar
45  International / Hardware / Re: mover servo vertical y horizontal on: February 28, 2013, 04:59:00 pm
mejor respuesta no puede haber, pero si solo buscas codigos asi, pues no aprenderas nada
Pages: 1 2 [3] 4 5 ... 23