Professional Documents
Culture Documents
Hi! I'm trying to have two circuits, each one with a LilyPad Arduino connected to a LilyPad Xbee, in order to have a
wireless connection between the two circuits.
I'm powering the LilyPad Arduino and connecting the TX, RX, + and - pins between the LilyPad Arduino and the LilyPad
Xbee. Both circuits are working well, but there aren't wireless communication. Anyone knows what I may be doing
wrong?
7027%26value3%3D3%26zone%3D560%26extra%3Dcontextualmatch%3Dnolimitation%7Clivetax%3D0%7Ccookietax%3D0%7Ccb%3D0bd0cc856e%7Ch_value%3D809017795d66402115
First I had this code working using Arduino and Xbee Shield with Xbee, know I'm trying to make the code work with
LilyPad Arduino and LilyPad Xbee, but I don't know if I need to do anything that I haven't done.
I'm working in Arduino 11 because de FrequencyTimer library doesn't work with recent versions of Arduino.
#include <FrequencyTimer2.h>
#define A { \
{ 1, 1, 1, 1}, \
{ 1, 1, 1, 1}, \
{ 1, 1, 1, 1}, \
{ 1, 1, 1, 1}, \
}
#define B { \
{ 0, 0, 0, 0}, \
{ 0, 0, 0, 0}, \
{ 0, 0, 0, 0}, \
{ 0, 0, 0, 0}, \
}
RE EDUCATION (//WWW.ARDUINO.CC/EDUCATION) PRO (//WWW.ARDUINO.CC/PRO) RESOURCES COMMUNITY HELP SIGN IN
#define C { \
{ 1, 0, 0, 0}, \
{ 0, 1, 0, 0}, \
{ 0, 0, 1, 0}, \
{ 0, 0, 0, 1}, \
}
#define D { \
{ 1, 0, 0, 1}, \
{ 0, 1, 1, 0}, \
{ 0, 1, 1, 0}, \
{1, 0, 0, 1}, \
}
#define E { \
{ 0, 0, 1, 0}, \
{ 0, 1, 0, 0}, \
{ 0, 1, 0, 0}, \
{ 0, 0, 1, 0}, \
}
byte col = 0;
byte leds[4][4];
// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)
int pins[9]= {-1, 3, 4, 6, 7, 11, 12, 8, 9};
byte propria[3][4][4]={
A,C,B
};
byte anima72[3][4][4]={
D,E,B
};
int pattern = 0;
int frame = 0;
//
int contador=0;
int relo=0;
void setup()
{
Serial.begin(9600);
for (int i = 1; i <= 8; i++) {
pinMode(pins, OUTPUT);
}
void loop()
{
//LIGA?ÌO
if (Serial.available() > 0) { //caso exista info "em linha de espera" ler
incomingByte = Serial.read();
delay(100);
Serial.print ('L');
Serial.flush();
}
else{
Serial.print ('L');//modo dormente
}
//AC?ÌO
}
else{
setPattern(propria[frame]);
frame++;
if(frame >= 3){
frame=0;
}
relo++;
if (relo>10){
relo=0;
contador=0;
}
}
delay(2000);
}
//
void clearLeds() {
// Clear display array
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
leds[j] = 0;
}
}
}
// Interrupt routine
void display() {
digitalWrite(cols[col], LOW); // Turn whole previous column off
col++;
if (col == 4) {
col = 0;
}
for (int row = 0; row < 4; row++) {
if (leds[col][3 - row] == 1) {
digitalWrite(rows[row], LOW); // Turn on this led
}
else {
digitalWrite(rows[row], HIGH); // Turn off this led
}
}
digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
delayMicroseconds(900); // Delay so that on times are longer than off time = brighter leds
}
#include <FrequencyTimer2.h>
#define A { \
{ 1, 1, 1, 1}, \
{ 1, 1, 1, 1}, \
{ 1, 1, 1, 1}, \
{ 1, 1, 1, 1}, \
}
#define B { \
{ 0, 0, 0, 0}, \
{ 0, 0, 0, 0}, \
{ 0, 0, 0, 0}, \
{ 0, 0, 0, 0}, \
}
#define C { \
{ 1, 0, 0, 0}, \
{ 0, 1, 0, 0}, \
{ 0, 0, 1, 0}, \
{ 0, 0, 0, 1}, \
}
#define D { \
{ 1, 0, 0, 1}, \
{ 0, 1, 1, 0}, \
{ 0, 1, 1, 0}, \
{1, 0, 0, 1}, \
}
#define E { \
{ 0, 0, 1, 0}, \
{ 0, 1, 0, 0}, \
{ 0, 1, 0, 0}, \
{ 0, 0, 1, 0}, \
}
byte col = 0;
byte leds[4][4];
// pin[xx] on led matrix connected to nn on Arduino (-1 is dummy to make array start at pos 1)
int pins[9]= {-1, 11, 3, 6, 8, 9, 7, 4, 12};
byte anima76[3][4][4]={
A,C,B
};
int pattern = 0;
int frame = 0;
//
int contador=0;
int relo=0;
void setup()
{
Serial.begin(9600);
for (int i = 1; i <= 8; i++) {
pinMode(pins, OUTPUT);
}
clearLeds();
void loop()
{
//LIGA?ÌO
if (Serial.available() > 0) { //caso exista info "em linha de espera" ler
incomingByte = Serial.read();
delay(100);
Serial.print ('H');
Serial.flush();
}
else{
Serial.print ('H');//modo dormente
}
//AC?ÌO
}
else{
RE E D U C A T I O N ( / / W W W . A R D U I N O . C C /EDUCATION) PRO (//WWW.ARDUINO.CC/PRO)
setPattern(propria[frame]); RESOURCES COMMUNITY HELP SIGN IN
frame++;
if(frame >= 3){
frame=0;
}
relo++;
if (relo>5){
relo=0;
contador=0;
}
}
delay(2000);
}
//
void clearLeds() {
// Clear display array
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
leds[j] = 0;
}
}
}
// Interrupt routine
void display() {
digitalWrite(cols[col], LOW); // Turn whole previous column off
col++;
if (col == 4) {
col = 0;
}
for (int row = 0; row < 4; row++) {
if (leds[col][3 - row] == 1) {
digitalWrite(rows[row], LOW); // Turn on this led
}
else {
digitalWrite(rows[row], HIGH); // Turn off this led
}
}
digitalWrite(cols[col], HIGH); // Turn whole column on at once (for equal lighting times)
delayMicroseconds(900); // Delay so that on times are longer than off time = brighter leds
}
The objective is that the two LED matrix have different animations and when they are near each other, the animations
exchange from one matrix to the other.
By the way, while generally you'll hook up TX to RX and vice versa, there are certain devices out there that label their
(https://forum.arduino.c pins differently, like the GM862, so always check the data sheet, or simply try swapping the connections if you're not
c/index.php? sure.
action=profile;u=1584)
--Rob
Newbie
Posts: 22
Karma: 1 [add]
(https://forum.arduino.c
c/index.php?
action=karma;sa=applau
d;uid=1584;a114b32140=7
551cc4a5bfbc7df0878bbe
0e9f507e5)
Thanks. By the way, I've found the solution to my problem precisely on your list.
Does anyone know of any solid tutorials on working with the Lilypad Xbee? I'm trying to get a project up and running,
and I'm not sure if I'm doing things correctly. I have some questions, perhaps someone could answer them?
In this project there is a performer who will be wearing the Lilypad. There will be 6 buttons, each corresponding to a
different video effect/treatment to a video running in Processing. So, couple questions:
1) The Lilypad Arduino and the Lilypad Xbee board will be essentially next to each other in the costume. I'll connect the
buttons to pins on the LParduino, and then are the only connections between the two boards rx, tx, power and
ground? Are there any connections I am overlooking?
2) the Lilypad Xbee will communicate with an Arduino Duemilanove with Xbee shield connected to the computer. This
is where it receives the instances of button presses, and tells Processing what to do. Does this Xbee need to be
connected to an Arduino or can it be connected via Sparkfun's USB Explorer breakout board? As I'm writing this, I'm
thinking that's a bit of a silly question, since I need to be able to tell the Xbee what to do... except that I'm thinking this
Xbee should still be able to receive the data and send it via USB to the Arduino program that is running. Is that correct?
Perfect!
Thanks Paul!
Hello Hello!
I was hoping someone might be able to shed some light on a project I am working on. The basic idea is this;
1) there is one performer, wearing a few sensors (flex, pressure, gyro, accel)
2) there are lilPad products involved (lpXbee, lpArduino)
3) the idea is that data received from the sensors will control/generate musical parameters within a software system.
2) Is there a solid basic starter code (like blinking an LED) that I can use as a tester to configure my lpXbee?
3) correct order?
lilyPad liPower (3.5V) to lpArduino to lpXbee?
or power to xB then arduino?
-the person above mentioned that she was working with a lpXbee *next to* a regular lilyPad..... is that necessary?
(reply later.... i see that the lpXB is a shield... not an arduino)
More info:
I also have the standard decimilinove and the nano.
I also have the liPower with the lp, and the lp arduino (and the xb w lp)
Hi Jennifer,
I can answer a few of your questions, but not so much on the software side (you would have to elaborate on this).
1) you will need two Xbee radios, one which is connected to your computer via FTDI breakout board (one of these:
http://www.sparkfun.com/products/9716) and a second which is used on the Lilypad Xbee board. The one on the LP
Xbee board transmits the data wirelessly to your computer.
2) You have to configure the Xbees before you can use them. You have to set it so that one listens to the other. A
decent tutorial (including starter code) can be found here: http://www.ladyada.net/make/xbee/arduino.html
3) I apply power to the Xbee because it has a voltage regulator which outputs 3.3V, which I then use to power the
Lilypad and any sensors.
I am trying to go wireless (hence the XBee) so i am a bit confused on if the USB to computer connection is just for
uploading the data, or if it always remain that way. Ultimately I will be sewing the circuits and wearing them.....
A little context:
I am building a pair of gloves that I want to wear to perform.
I would like to have a wireless connection to my computer via the XBee
I am thinking I should strap on both of the lilyPadboards (the arduino and the xbee)... true?
The Lilypad Arduino is not connected to the computer, it will be part of your wearable setup. I just realized that I
posted the wrong Sparkfun link in my previous message (re: FTDI breakout board). The only time you need the
breakout board is when you are uploading code to your Lilypad Arduino. When you are done, you disconnect it.
So, you basically have two setups: one stationary (Xbee Explorer w/Xbee radio + computer) and the other wearable
(Lilypad Arduino + Lilypad Xbee w/ Xbee radio + sensors/actuators + batteries).
Go Up Pages: [1]
PRINT (HTTPS://FORUM.ARDUINO.CC/INDEX.PHP?ACTION=PRINTPAGE;TOPIC=28738.0)
Jump to:
===> Troubleshooting Go