Show Posts
Pages: [1]
1  Using Arduino / LEDs and Multiplexing / Re: Controlling 8 rgb leds common anode on: June 16, 2013, 03:38:20 am
oh ok thanks  smiley ! I guess i'll ship it from the uk
2  Using Arduino / LEDs and Multiplexing / Re: Controlling 8 rgb leds common anode on: June 15, 2013, 02:49:44 pm
Having not found any shop near me (online or offline) that sells these WS2803, I ended up finding a chip similar to the ULN2803 that could work with commmon anode rgb leds... maybe.. it's a UDN2982A. Do you think this could be used for my project, with similar pinnning than the ULN2803?
3  Using Arduino / LEDs and Multiplexing / Controlling 8 rgb leds common anode on: June 15, 2013, 05:50:32 am
Hi I'm currently controlling 8 rgb leds common cathode with a ULN2803, however I need to use these smaller square rgb leds for a project, but they are common anode.
Got this scheme from a tutorial on youtube, but I need to change it to fit the common anode rgb leds.
I know I have to use NPN transistors instead of PNP transistors connected to the 3 PWM pins that controll colors; with emitters connected to GND.
However the ULN2803 doesn't seem to work with common anode leds, i believe it is because the transistors inside the ULN2803 only work one way.
Is there something similar to the ULN2803 but inverted, i mean, that can work with common anode leds?
Or what else should I use if there is no symmetric replacement?
Thanks
4  Using Arduino / Networking, Protocols, and Devices / Re: multiple arduinos with bluetooth - android on: June 13, 2013, 04:10:15 pm
Hi pylon thank you for your reply.
I'm using a nexus 7, which is able to handle up to at least two bluetooth devices, since you can connect a wireless keyboard and wireless headphones at the same time.
I'm using Processing to code the application for the android, with the Ketai bluetooth library, could it be possible there are some restrictions to bluetooth connections because of this?
5  Using Arduino / Networking, Protocols, and Devices / multiple arduinos with bluetooth - android on: June 12, 2013, 10:21:34 am
Hello and thanks for reading

I am currently working on this project involving 3 arduinos (2 Lilypad, 1 Uno), each one with a bluetooth module (2 Bluetooth mate, 1 seedbluetooth shield); several sensors (accelerometer/magnetometer) and one android tablet (using the Bluetooth Ketai Library).

Since I need to send data from the arduinos to the android and viceversa, I needed to know if this is possible. I mean, can I connect several bluetooth modules to my Android, and how? Because, actually I can connect to one of the arduinos, and when I try to connect to the second one at the same time, the first one gets disconnected.

The Ketai library says explicitly that one can connect several bluetooth devices to the android, but I must be doing something wrong since it has not been possible for me. Any hints?
6  Using Arduino / Networking, Protocols, and Devices / Re: WiShield & find() function on: May 02, 2012, 10:14:03 am
hum, sorry i did not understand your last post

Quote
void printData(char* data, int len)
{
   Serial.println("printData ==>"); 
// snipped
   Serial.println("printData <==");
}
We need to know when the function is being called!
7  Using Arduino / Networking, Protocols, and Devices / Re: WiShield & find() function on: May 02, 2012, 08:35:37 am
You're right i should not be looking for a token ending at < .
And yes i want to get what is inside of "" and > <.

a cleaner code, where i manage to find r :
Code:
void printData(char* data, int len) {
 
  /*while (len-- > 0) {
      Serial.println(data);
  }*/
 
  char * spanstring = "span";
  resultat = strstr(data, spanstring); // find the string "span" within data
 
  if (resultat != NULL){               // if there is a result (resultat)
    Serial.println();
    Serial.print("resultat: [");
    Serial.print(resultat);
    Serial.println("]");
 
    char * tokenstringone = "\"";      // get the token ending at " (resultattwo should be: [span id=])
    resultattwo = strtok(resultat, tokenstringone);
    Serial.print("resultattwo: [");
    Serial.print(resultattwo);
    Serial.println("]");
   
    resultatthree = strtok(NULL, tokenstringone); // get the next token ending at "  (resultatthree should be: [r])
    Serial.print("resultatthree: [");
    Serial.print(resultatthree) ;
    Serial.println("]");
  }
  else if (resultat == NULL){
    Serial.println("no span found");
  }
}

result:

resultat: [span id="r">145</span>
<span id="g">100</span>
<span id="b">54</span>
</b]
resultattwo: [span id=]
resultatthree: [r]

resultat: [span id=]
resultattwo: [span id=]
resultatthree: [É]

resultat: [span id=]
resultattwo: [span id=]
resultatthree: [É]

I dont understand why resultat changes though
8  Using Arduino / Networking, Protocols, and Devices / Re: WiShield & find() function on: May 02, 2012, 07:22:04 am
Ok after much struggling i was able to find the strstr "span", and get a token that ends with   "   or  <  .
However, i have no clue as to how to throw away the first token ending with ", then finding the next one ending with " (should be  r  ).
I've not been able to parse the data into an int either, though i imagine it has to do something with the atoi function?

oops, forgot to copy/paste the code:

Code:
char * resultat=NULL;
char * resultattwo=NULL;

void printData(char* data, int len) {
 
  /*while (len-- > 0) {
      Serial.println(data);
  }*/
  char * spanstring = "span";
  resultat = strstr(data, spanstring);
  if (resultat != NULL){
    Serial.println("I found strstr");
    Serial.println(resultat);
    char * tokenstringone = "<";
    resultattwo = strtok(resultat, tokenstringone);
    Serial.println("I found strtok");
    Serial.println(resultattwo);
   
    //  char * token = strtok(data, "\"");
  }
}

and the ouput:


Connexion wifi lanceeI found strstr
span id="r">145</span>
<span id="g">100</span>
<span id="b">54</span>
</b
I found strtok
span id="r">145
I found strstr
span id="r">145
I found strtok
span id="r">145
I found strstr
span id="r">145
I found strtok
span id="r">145


why is it repeating itself? Oo
9  Using Arduino / Project Guidance / Arduino: wifi parameters on: May 02, 2012, 05:51:29 am
I'm currently working on a project with Arduino and a Wishield (asynclabs model), that involves multiple users, user ids etc:
Changing the color of a lamp by connecting to a webserver on the internet:
Webpage processes all the info, and prints a .php file with only the color to apply to the lamp. Arduino gets that info and changes the color.

I was wondering if there was a way for a non experienced user to set the wifi parameters with a user interface (local ip, router ip, ssid, password...) without ever having to touch the code on the arduino program.
I mean can i save the parameters in different variables, save the in the arduino memory, so it can be able to connect to the local wifi?

Seems impossible but if anyone has an idea it would be really great.
10  Using Arduino / Networking, Protocols, and Devices / Re: WiShield & find() function on: April 25, 2012, 08:14:08 am
Indeed, the first part of the data doesn't interest me, only the <span id="r">150</span> things.
I'm gonna try to adapt the sketch, with the elements you are telling me.
I'll let you know if i'm successful or not, thanks again
11  Using Arduino / Networking, Protocols, and Devices / Re: WiShield & find() function on: April 25, 2012, 07:43:31 am
Ok, I understant the '<','/','s','p','a','n' problem, changed it to the 's' letter, (now i understand why the C example only used a '#' tu cut the string);
I also added a Serial.print(data) to see what the arduino is receiving. here it goes (i know it's a bit messy, sorry):

Code:
Code:
void printData(char* data, int len) {
  Serial.print(data);
  if (len-- > 0) {
    char *resultat= NULL;
      resultat = strtok(data, "s"); //cut data into pieces when s is found
      if( !resultat){
         // otput debug error if nothing of the sort is found
         Serial.println("not working!");
      }
      while (resultat != NULL){
        Serial.println("result is");
        Serial.println(resultat );
        resultat = strtok(NULL, "s");
      }
  }
}

result:
Connexion wifi lanceeHTTP/1.1 200 OK
Date: Wed, 25 Apr 2012 12:33:30 GMT
Server: Apache
Last-Modified: Wed, 25 Apr 2012 09:46:23 GMT
ETag: "816e4162-64-4be7dbe893ec6"
Accept-Rangesresult is
HTTP/1.1 200 OK
Date: Wed, 25 Apr 2012 12:33:30 GMT
Server: Apache
La
result is
t-Modified: Wed, 25 Apr 2012 09:46:23 GMT
ETag: "816e4162-64-4be7dbe893ec6"
Accept-Range
: bytes
Content-Length: 100
Connection: close
Content-Type: text/html

<html>
<body>
<span id="r">145</span>
<span id="g">100</span>
<span id="b">54</span>
</bresult is
: byte
result is

Content-Length: 100
Connection: clo
result is
e
Content-Type: text/html

<html>
<body>
<
result is
pan id="r">145</
result is
pan>
<
result is
pan id="g">100</
result is
pan>
<
result is
pan id="b">54</
result is
pan>
</b
ody>
</html>
Connedy>
</html>
Connection: cloresult is
ody>
</html>
Connedy>
</html>
Connection: clo
ody>
</html>
Connedy>
</html>
Connection: clo
12  Using Arduino / Networking, Protocols, and Devices / Re: WiShield & find() function on: April 25, 2012, 04:52:38 am
Thanks PaulS for your advice,

so I changed the void printData () function, and added the strtok() in it. So far i've only been able to cut the webpage into pieces of information.
I only want to get the information concerning the color in numeric values (not strings), and put them into r, g and b.
I'm sorry i'm really not good at handling strings or at C, i really need some help.

int r; int g; int b;

void printData(char* data, int len) {
  if (len-- > 0) {
    char *resultat= NULL;
      resultat = strtok(data, "</span>");
      if( !resultat){
         Serial.println("not working!");
      }
      while (resultat != NULL){
        Serial.println("result is");
        Serial.println(resultat );
        resultat = strtok(NULL, "</span>");
      }
  }
}


And the serial monitor gives me:

result is
HTTP
result is
1.1 200 OK
D
result is
te: Wed, 25 A
result is
r 2012 09:48:36 GMT
Server: A
result is
che
L
result is
t-Modified: Wed, 25 A
result is
r 2012 09:46:23 GMT
ET
result is
g: "816e4162-64-4be7dbe893ec6"
Acce
result is
t-R
result is
ge
result is
: byte
result is

Co
result is
te
result is
t-Le
result is
gth: 100
Co
result is
ectio
result is
: clo
result is
e
Co
result is
te
result is
t-Ty
result is
e: text
result is
html


result is
html
result is


result is
body
result is


result is
 id="r"
result is
145
result is


result is
 id="g"
result is
100
result is


result is
 id="b"
result is
54
result is


result is
b
result is
ody
result is


result is
html
result is

Co
13  Using Arduino / Networking, Protocols, and Devices / WiShield & find() function on: April 24, 2012, 02:25:21 pm
Hi,
i'm having some troubles with extracting values from a website, using a WiShield (asynclabs) and Arduino un0, in order to light a rgb led.

My arduino is able to connect to the webpage where i want to extract my values, and to print on the serial monitor the result: the html code of the pag which is:

<html><body>
<span id="r"></span><span id="g"></span><span id="b"></span>
</body></html>

(yes Arduino has to be programed as a client, and yes it absolutely has to be connected via wifi)

I now want to extract the values for r,g,b, and parse them into 3 ints: red, green, blue (0-255) on the arduino, so i can light the 3 leds accordingly.
I know textFinder library can do this, but only for Ethernet connections, and I don't know if the new find() function, that appears to have been implemented with Arduino 1.0, works for the WiShield.

The arduino code that i'm using is as follows, and is based on the example for simple client present in the asynclabs wishield library.
If any of you has an idea on how to solve this please tell me!
If anyone knows where i can get more info on the new find() function (besides arduino.cc reference) i would really appreciate it, even if i have to look at the Core libraries of the Arduino.
Thanks,

/*
 * A simple sketch that uses WiServer to get the hourly weather data from LAX and prints
 * it via the Serial API
 */

#include <WiServer.h>

#define WIRELESS_MODE_INFRA   1
#define WIRELESS_MODE_ADHOC   2

// Wireless configuration parameters ----------------------------------------
unsigned char local_ip[] = {10,0,1,3};   // IP address of WiShield
unsigned char gateway_ip[] = {10,0,1,1};   // router or gateway IP address
unsigned char subnet_mask[] = {255,255,255,0};   // subnet mask for the local network
const prog_char ssid[] PROGMEM = {"AABBCC"};      // max 32 bytes

unsigned char security_type = 0;   // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = {"aabbcc"};   // max 64 characters

// WEP 128-bit keys
// sample HEX keys
prog_uchar wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,   // Key 0
              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   // Key 1
              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,   // Key 2
              0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // Key 3
            };

// setup the wireless mode
unsigned char wireless_mode = WIRELESS_MODE_INFRA;

unsigned char ssid_len;
unsigned char security_passphrase_len;
// End of wireless configuration parameters ----------------------------------------


void printData(char* data, int len) {
  while (len-- > 0) {
    Serial.print(*(data++));
  }
}

uint8 ip[] = {1,2,3,4};
GETrequest getPage(ip, 80, "www.aabbcc.com", "/abc.html");

int testing;

void setup(){
  WiServer.init(NULL);
  //WiServer.enableVerboseMode(true);
  Serial.begin(9600);
  Serial.print("Connexion wifi lancee");
  getPage.setReturnFunc(printData);
  delay(1000);
}

long updateTime = 0;

void loop(){ 
  if (millis() >= updateTime) {
    getPage.submit();   
    // Get another update one minute from now
    updateTime += 1000 * 60 * 01;
  }
  WiServer.server_task();
}
Pages: [1]