Show Posts
Pages: 1 2 [3] 4 5
31  Using Arduino / Programming Questions / Re: error compile my code on: February 27, 2013, 10:12:41 pm
Normally to call it i use String not string, if i put string, it say that i have not  declare it.
32  Using Arduino / Programming Questions / Re: error compile my code on: February 27, 2013, 09:53:36 pm
maybe it late here but i don't understand what you means?
Sorry
33  Using Arduino / Programming Questions / error compile my code on: February 27, 2013, 09:28:36 pm
Here the code:
Code:
// Demo using DHCP and DNS to perform a web client request.
// 2011-06-08 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php

#include <EtherCard.h>
#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();
#define garderobe "82"

// ethernet interface mac address, must be unique on the LAN
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };

byte Ethernet::buffer[700];
static uint32_t timer;

char website[] PROGMEM = "192.168.2.19";
static byte hisip[] = {192,168,2,19};

// called when the client request is complete
static void my_callback (byte status, word off, word len) {
  Serial.println(">>>");
  Ethernet::buffer[off+300] = 0;
  Serial.print((const char*) Ethernet::buffer + off);
  Serial.println("...");
}

void setup () {
  Serial.begin(57600);
  Serial.println("\n[webClient]");
  mySwitch.enableReceive(1);

  if (ether.begin(sizeof Ethernet::buffer, mymac, 10) == 0)
    Serial.println( "Failed to access Ethernet controller");
  if (!ether.dhcpSetup())
    Serial.println("DHCP failed");

  ether.printIp("IP:  ", ether.myip);
  ether.printIp("GW:  ", ether.gwip); 
  ether.printIp("DNS: ", ether.dnsip);
  ether.copyIp(ether.hisip, hisip);
  ether.hisport = 3480;
  ether.printIp("SRV: ", ether.hisip);

  if (!ether.dnsLookup(website))
    Serial.println("DNS failed");
   
  ether.printIp("SRV: ", ether.hisip);
}

void loop () {
  ether.packetLoop(ether.packetReceive());
   if (mySwitch.available()) {
    unsigned long code = mySwitch.getReceivedValue();
    Serial.print("Received :");
    Serial.println( code );
    if (code == 5586965)
      {
    mySwitch.resetAvailable();
    sendtovera(garderobe);
}
}
}
void sendtovera(String devid){
 ether.browseUrl(PSTR("/data_request?id=action&DeviceNum=52&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget&newTargetValue="), devid, website, my_callback);
}


error:
Code:
nc28j60.cpp: In function 'void sendtovera(String)':
enc28j60:63: error: no matching function for call to 'EtherCard::browseUrl(char*, String&, char [13], void (&)(byte, word, word))'
/Users/Michael/Documents/Arduino/libraries/ethercardmaster/EtherCard.h:164: note: candidates are: static void EtherCard::browseUrl(prog_char*, const char*, prog_char*, void (*)(uint8_t, uint16_t, uint16_t))

I'm loss, i thing that ether card do not like string but not sure
thanks
34  Using Arduino / Networking, Protocols, and Devices / Re: arduino nano with enc28j60 ethercard not working on: February 27, 2013, 01:40:51 pm
Fixed by changing the baud in the serial monitor. but it do not showing up the address
35  Using Arduino / Networking, Protocols, and Devices / arduino nano with enc28j60 ethercard not working on: February 27, 2013, 01:21:57 pm
Hi,
    i receive today my ethernet card for the arduino nano. I've been able to use the ethershield library and ping it but since the ethernetcard seems more recent i will like to us this library with the client function. All i want is to post a request to an automatisation box when something trigger it. With the original ethernet shield and library i have no problem but with this one!!!. The sketch compile and upload it without any problem. but when i try the dhcpanddns example, if i open the serial monitor i only get this:  ΓΏ
What i'm doing wrong

Thanks
36  Using Arduino / Programming Questions / Put long string in flash memory on: February 17, 2013, 11:35:42 am
Hi,
    i need to store (read,write) 5 string like this "05000005329000" in the flash memory so when the arduino is power off it will keep the data in. I checked the eeprom fonction but it only one byte, i'm a little lost with that. and it is possible to create a list and able to modified it so if a sting is equal with a string in the list then do it?

Thanks in advance
Like i say i checked on the net but i'm lost whit that
37  Using Arduino / Programming Questions / Re: Unable to compile on: February 15, 2013, 01:21:39 pm
Sorry for the stupid error thanks very much. For sure now it work
38  Using Arduino / Programming Questions / Re: Unable to compile on: February 15, 2013, 12:56:23 pm
I'm probably slow today, sorry, i don't understand what you means?
39  Using Arduino / Programming Questions / Unable to compile on: February 15, 2013, 12:43:41 pm
Maybe a stupid error but i'm not able to compile this code, it always tell me that the KeyCode was not declare in the scope.
Here the code:

Code:
// RFID reader for Arduino
// Wiring version by BARRAGAN <http://people.interaction-ivrea.it/h.barragan>
// Modified for Arudino by djmatic
// Re-Modified for Arduino and 125Khz JsxzLz RFID Kit from Ebay by Biohazard

// RFID reader comes with 11 pins: D3 D2 D1 Rest Mcst Gnd L1 L2 PC TX VCC
// We need these to be connected:
// Rest to Arduino pin 2
// Gnd to Arduino GND
// L1 and L2 to the antenna
// TX to Arduino RX0
// VCC To Arduino 5V


int  val = 0;
char code[14];
String keyCode;

String  master = "4B00108513470F";

// 10 digits card code
// 2 digits parity bits

int bytesread = 0;

void setup() {

  Serial.begin(9600);     // RFID reader TX pin, Baud rate: 9600, Data bits: 8, stop bit: 1.
  pinMode(2,OUTPUT);      // Set digital pin 2 as OUTPUT to connect it to the RFID RESET pin
  digitalWrite(2, HIGH);  // Activate the RFID reader
  Serial.println("rfid ready to read");
 



void loop() {
 
  if(Serial.available() > 0) {            // if data available from reader
    if((val = Serial.read()) == 10) {     // check for header
      bytesread = 0;
      while(bytesread < 14) {             // read 14 digit code
        if( Serial.available() > 0) {
          val = Serial.read();
          if((val == 10)||(val == 13)) {  // if header or stop bytes before the 10 digit reading
            break;                        // stop reading
          }
          code[bytesread] = val;          // add the digit           
          bytesread++;                    // ready to read next digit 
        }
      }
      if(bytesread == 14) {         // if 14 digit read is complete
        keyCode = code;
        keyCode = keyCode.substring(0,14);
        if (KeyCode == master)
          Serial.println("Master key passed");
           
      }
      bytesread = 0;
      digitalWrite(2, LOW);               // deactivate the RFID reader for a moment so it will not flood
      delay(1500);                        // wait for a bit
      digitalWrite(2, HIGH);              // Activate the RFID reader
    }
  }
 
  }

I declare the KeyCode at the statup so why this error
Thanks
40  Using Arduino / Project Guidance / Arduino deal with a list. on: February 12, 2013, 05:57:02 pm
Hi again,
              is there a way to create a list of char array that have been read from serial and then store it in a list so if one of the stored  array is read again, it will send true. So the idea is to have a master rfid tag that will serve to reccord and delete other tag in the list.
41  Using Arduino / Programming Questions / Re: compare char to char on: February 12, 2013, 02:33:44 pm
Thanks, sorry for the newbie question, thanks everything is working.
42  Using Arduino / Programming Questions / Re: compare char to char on: February 12, 2013, 02:26:28 pm
Got it work now, just one last thing, here the code:

Code:
// RFID reader for Arduino
// Wiring version by BARRAGAN <http://people.interaction-ivrea.it/h.barragan>
// Modified for Arudino by djmatic
// Re-Modified for Arduino and 125Khz JsxzLz RFID Kit from Ebay by Biohazard

// RFID reader comes with 11 pins: D3 D2 D1 Rest Mcst Gnd L1 L2 PC TX VCC
// We need these to be connected:
// Rest to Arduino pin 2
// Gnd to Arduino GND
// L1 and L2 to the antenna
// TX to Arduino RX0
// VCC To Arduino 5V


int  val = 0;
char code[14];
char michael[14] = {'4', 'B', '0', '0', '1', '0', '8', '5', '1', '3', '4', '7', '0', 'F'};
char emilie[14] =  {'0', '5', '0', '0', '1', '5', '1', '5', '6', '7', '3', '9', '0', 'D'};;


// 10 digits card code
// 2 digits parity bits

int bytesread = 0;

void setup() {

  Serial.begin(9600);     // RFID reader TX pin, Baud rate: 9600, Data bits: 8, stop bit: 1.
  pinMode(2,OUTPUT);      // Set digital pin 2 as OUTPUT to connect it to the RFID RESET pin
  digitalWrite(2, HIGH);  // Activate the RFID reader
  Serial.println("rfid ready to read");
 



void loop() {
 
   boolean e_card = true;
   boolean m_card = true;
  if(Serial.available() > 0) {            // if data available from reader
    if((val = Serial.read()) == 10) {     // check for header
      bytesread = 0;
      while(bytesread < 14) {             // read 14 digit code
        if( Serial.available() > 0) {
          val = Serial.read();
          if((val == 10)||(val == 13)) {  // if header or stop bytes before the 10 digit reading
            break;                        // stop reading
          }
          code[bytesread] = val;          // add the digit           
          bytesread++;                    // ready to read next digit 
        }
      }
      if(bytesread == 14) {         // if 14 digit read is complete
        if( memcmp(code, michael,14) != 0) m_card = false;
        if( memcmp(code, emilie,14) != 0) e_card = false;
       
        if (m_card)   
          {
            Serial.println("welcome Michael");
          }
         else if (e_card)
            {
            Serial.println("welcome Emilie");
            }
         else;
            {
            Serial.println("Unknow tag"); 
            }
           
      }
      bytesread = 0;
      digitalWrite(2, LOW);               // deactivate the RFID reader for a moment so it will not flood
      delay(1500);                        // wait for a bit
      digitalWrite(2, HIGH);              // Activate the RFID reader
    }
  }
 
  }
 


Why i always getting unknow tag event if it a valide one.

If i pass a good one it also print in unknow tag
rfid ready to read
welcome Emilie
Unknow tag

Thanks
43  Using Arduino / Programming Questions / Re: compare char to char on: February 12, 2013, 01:32:53 pm
It seems to work now but could you tell me how can i flush the array after print have been done cause now it always print after the good card have been pass.
thanks
44  Using Arduino / Programming Questions / Re: compare char to char on: February 12, 2013, 01:21:43 pm
My mistake, thanks for the ==. Don't no why i done that. Now the code working and it show me the 14 digit of the card in the serial monitor. I will try the memcmp() like you said and comeback to you thanks.
45  Using Arduino / Programming Questions / compare char to char on: February 12, 2013, 01:06:08 pm
I'm trying to do something when rfid char match. here the code
Code:
// RFID reader for Arduino
// Wiring version by BARRAGAN <http://people.interaction-ivrea.it/h.barragan>
// Modified for Arudino by djmatic
// Re-Modified for Arduino and 125Khz JsxzLz RFID Kit from Ebay by Biohazard

// RFID reader comes with 11 pins: D3 D2 D1 Rest Mcst Gnd L1 L2 PC TX VCC
// We need these to be connected:
// Rest to Arduino pin 2
// Gnd to Arduino GND
// L1 and L2 to the antenna
// TX to Arduino RX0
// VCC To Arduino 5V


int  val = 0;
char code[14];
char michael[14] = {'4', 'B', '0', '0', '1', '0', '8', '5', '1', '3', '4', '7', '0', 'F'};
// 2 digits manufacture code
// 10 digits card code
// 2 digits parity bits

int bytesread = 0;

void setup() {

  Serial.begin(9600);     // RFID reader TX pin, Baud rate: 9600, Data bits: 8, stop bit: 1.
  pinMode(2,OUTPUT);      // Set digital pin 2 as OUTPUT to connect it to the RFID RESET pin
  digitalWrite(2, HIGH);  // Activate the RFID reader



void loop() {

  if(Serial.available() > 0) {            // if data available from reader
    if((val = Serial.read()) == 10) {     // check for header
      bytesread = 0;
      while(bytesread < 14) {             // read 14 digit code
        if( Serial.available() > 0) {
          val = Serial.read();
          if((val == 10)||(val == 13)) {  // if header or stop bytes before the 10 digit reading
            break;                        // stop reading
          }
          code[bytesread] = val;          // add the digit           
          bytesread++;                    // ready to read next digit 
        }
      }
      if(bytesread == 14) {         // if 14 digit read is complete
       
        Serial.print("TAG code is: ");    // possibly a good TAG
        Serial.println(code);             // print the TAG code
      }
      bytesread = 0;
      digitalWrite(2, LOW);               // deactivate the RFID reader for a moment so it will not flood
      delay(1500);                        // wait for a bit
      digitalWrite(2, HIGH);              // Activate the RFID reader
    }
  }
  if (code = michael)
  {
    Serial.print("welcome michael");
  }

   
 
}

It give me this error when trying to copile it: error: invalid array assignment
Checked on the net without any clue
Thanks in advance
Pages: 1 2 [3] 4 5