hi fellow programers ,
lemme introduce me first , i'm french student work on project called "reproduce daft punk helmet" final exam.
i working 2 meters of adafruit 60led/m strip , acheived visor :
the helmet being made friend of mine.
#include <adafruit_gfx.h>
#include <adafruit_neomatrix.h>
#include <adafruit_neopixel.h>
#ifndef pstr
#define pstr
#endif
#define pin 4
#include <softwareserial.h> //software serial port
#define rxd 2
#define txd 3
softwareserial bluetoothserial(rxd,txd);
string chrecue="";
char recvchar=0;
adafruit_neomatrix matrix = adafruit_neomatrix(14, 7, pin4,
neo_matrix_top + neo_matrix_left +
neo_matrix_rows + neo_matrix_zigzag, //montage en zigzag : on inverse un bandeau sur 2
neo_rgb + neo_khz800);
const uint16_t colors[] = {
matrix.color(255, 0, 0), matrix.color(0, 255, 0), matrix.color(0, 0, 255) };
void setupbluetoothconnection()
{
bluetoothserial.begin(9600); // set bluetoothbee baudrate default baud rate 38400
bluetoothserial.print("\r\n+stwmod=0\r\n"); // set bluetooth work in slave mode
bluetoothserial.print("\r\n+stna=seeedbtslave\r\n"); // set bluetooth name "seeedbtslave"
bluetoothserial.print("\r\n+stoaut=1\r\n"); // permit paired device connect me
bluetoothserial.print("\r\n+stauto=0\r\n"); // auto-connection should forbidden here
delay(2000); // delay required.
bluetoothserial.print("\r\n+inq=1\r\n"); // make slave bluetooth inquirable
serial.println("the slave bluetooth inquirable!");
delay(2000); // delay required.
bluetoothserial.flush();
}
void setup()
{
matrix.begin();
matrix.settextwrap(false);//bandeau non fermé
matrix.setbrightness(20);//luminosité des led
matrix.settextcolor(colors[0]);//init couleur
serial.begin(9600);
serial.println("init");
pinmode(rxd, input);
pinmode(txd, output);
setupbluetoothconnection();
}
int x = matrix.width();
int pass = 0;
void loop()
{
if(bluetoothserial.available())
{//check if there's data sent remote bluetooth shield
recvchar = bluetoothserial.read();
chrecue = chrecue + recvchar;
serial.print(recvchar);
if(recvchar == 13)
{
matrix.fillscreen(0);
matrix.setcursor(x, 0);
matrix.print(chrecue);
chrecue="";
}
}
matrix.show();
delay(100);
}
^ program supposed allow me connect bluetooth device , , display characters inputted usual blutooth monitor , of teachers , can't work ...
it connect bt monitor on phone , impossible else , module seeestudio shield v2.
i'm here see if there's problem program , if of can provide me help.
p.s : sorry if see grammar error , i'm french it's little weird post in english)
lemme introduce me first , i'm french student work on project called "reproduce daft punk helmet" final exam.
i working 2 meters of adafruit 60led/m strip , acheived visor :
the helmet being made friend of mine.
#include <adafruit_gfx.h>
#include <adafruit_neomatrix.h>
#include <adafruit_neopixel.h>
#ifndef pstr
#define pstr
#endif
#define pin 4
#include <softwareserial.h> //software serial port
#define rxd 2
#define txd 3
softwareserial bluetoothserial(rxd,txd);
string chrecue="";
char recvchar=0;
adafruit_neomatrix matrix = adafruit_neomatrix(14, 7, pin4,
neo_matrix_top + neo_matrix_left +
neo_matrix_rows + neo_matrix_zigzag, //montage en zigzag : on inverse un bandeau sur 2
neo_rgb + neo_khz800);
const uint16_t colors[] = {
matrix.color(255, 0, 0), matrix.color(0, 255, 0), matrix.color(0, 0, 255) };
void setupbluetoothconnection()
{
bluetoothserial.begin(9600); // set bluetoothbee baudrate default baud rate 38400
bluetoothserial.print("\r\n+stwmod=0\r\n"); // set bluetooth work in slave mode
bluetoothserial.print("\r\n+stna=seeedbtslave\r\n"); // set bluetooth name "seeedbtslave"
bluetoothserial.print("\r\n+stoaut=1\r\n"); // permit paired device connect me
bluetoothserial.print("\r\n+stauto=0\r\n"); // auto-connection should forbidden here
delay(2000); // delay required.
bluetoothserial.print("\r\n+inq=1\r\n"); // make slave bluetooth inquirable
serial.println("the slave bluetooth inquirable!");
delay(2000); // delay required.
bluetoothserial.flush();
}
void setup()
{
matrix.begin();
matrix.settextwrap(false);//bandeau non fermé
matrix.setbrightness(20);//luminosité des led
matrix.settextcolor(colors[0]);//init couleur
serial.begin(9600);
serial.println("init");
pinmode(rxd, input);
pinmode(txd, output);
setupbluetoothconnection();
}
int x = matrix.width();
int pass = 0;
void loop()
{
if(bluetoothserial.available())
{//check if there's data sent remote bluetooth shield
recvchar = bluetoothserial.read();
chrecue = chrecue + recvchar;
serial.print(recvchar);
if(recvchar == 13)
{
matrix.fillscreen(0);
matrix.setcursor(x, 0);
matrix.print(chrecue);
chrecue="";
}
}
matrix.show();
delay(100);
}
^ program supposed allow me connect bluetooth device , , display characters inputted usual blutooth monitor , of teachers , can't work ...
it connect bt monitor on phone , impossible else , module seeestudio shield v2.
i'm here see if there's problem program , if of can provide me help.
p.s : sorry if see grammar error , i'm french it's little weird post in english)
i cannot comment on leds, bluetooth stuff has me curious , there similar thread around @ moment.
for starters, line
the command not set bluetooth baud rate @ 38400, not set baud rate @ 9600. tell arduino operate @ 9600 on defined port, won't if bluetooth set @ 38400 default.
the first thing need find out default baud rate is. doesn't matter is, don't think need change it, need ensure arduino works @ same rate.
i think bluetooth code complete junk. might wrong but, if case, submit have made pretty bad choice of bluetooth device. indeed, since understand wearable device, think have made bad choice anyway.
in matter of code, should able want no more code send serial monitor. idea of having set bleutooth name "seedbtslave" every time switch on absurd.
in matter of shield, might consider putting on ebay , getting simple jy-mcu module. actual electronics same, cheaper, surely more appropriate job, , code commonly available , thousand times more sensible.
to started, might find useful
homepages.ihug.com.au/~npyner/arduino/bt_2_way.ino
and background here
homepages.ihug.com.au/~npyner/arduino/guide_2bt.pdf
you might find work seed shield. try it!
note arduino not involved connection between bluetooth , phone.
for starters, line
quote
bluetoothserial.begin(9600); // set bluetoothbee baudrate default baud rate 38400is complete nonsense, possibly unnecessary, , possibly cause of problems.
the command not set bluetooth baud rate @ 38400, not set baud rate @ 9600. tell arduino operate @ 9600 on defined port, won't if bluetooth set @ 38400 default.
the first thing need find out default baud rate is. doesn't matter is, don't think need change it, need ensure arduino works @ same rate.
i think bluetooth code complete junk. might wrong but, if case, submit have made pretty bad choice of bluetooth device. indeed, since understand wearable device, think have made bad choice anyway.
in matter of code, should able want no more code send serial monitor. idea of having set bleutooth name "seedbtslave" every time switch on absurd.
in matter of shield, might consider putting on ebay , getting simple jy-mcu module. actual electronics same, cheaper, surely more appropriate job, , code commonly available , thousand times more sensible.
to started, might find useful
homepages.ihug.com.au/~npyner/arduino/bt_2_way.ino
and background here
homepages.ihug.com.au/~npyner/arduino/guide_2bt.pdf
you might find work seed shield. try it!
note arduino not involved connection between bluetooth , phone.
Arduino Forum > Using Arduino > Programming Questions > Bluetooth programming questions
arduino
Comments
Post a Comment