求高手写一个processing和arduino数据传输的程序
processing吧
全部回复
仅看楼主
level 1
超搞笑℃ 楼主
本人正在做一个32*32RGB点阵,需要用processing来控制。
我用的是processing作为上位机,传输一个坐标给arduino,现在就在传输程序上卡住了。
下面是processing的程序:
void setup() { size(640, 640);
ellipseMode(CENTER);
}
void draw()
{ }
void mousePressed(){
for(int x=0 ;x<width;x=x+20){
for(int y=0;y<width;y=y+20){
// stroke(255,0,255);
// fill(128,128,128);
// background(0,128,128);
int d=20;
if ((mouseX > x) && (mouseX < x+20) &&
(mouseY > y) && (mouseY < y+20)){
//rect(mouseX, mouseY, 20, 20);
fill(0);
}else {
fill(255);
}
rect(x,y,d,d);
}
}
}
2013年07月07日 07点07分 1
level 1
超搞笑℃ 楼主
就是把这个坐标发给arduino,然后还需要一个arduino的接收程序
2013年07月07日 07点07分 2
level 1
超搞笑℃ 楼主
我还有一个直接用arduino点亮一个灯的程序。我用的是arduino Mega 2560的板子。
用Arduino点亮点阵上的一个LED灯的程序:
// testshapes demo for RGBmatrixPanel library.
// Demonstrates the drawing abilities of the RGBmatrixPanel library.
// For 32x32 RGB LED matrix.
#include <Adafruit_GFX.h> // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
// If your 32x32 matrix has the SINGLE HEADER input,
// use this pinout:
#define CLK 50 // MUST be on PORTB!
#define OE 51
#define LAT 52
#define A A0
#define B A1
#define C A2
#define D A3
// If your matrix has the DOUBLE HEADER input, use:
//#define CLK 8 // MUST be on PORTB!
//#define LAT 9
//#define OE 10
//#define A A3
//#define B A2
//#define C A1
//#define D A0
RGBmatrixPanel matrix(A, B, C, D, CLK, LAT, OE, false);
void setup() {
matrix.begin();
// draw a pixel in solid white
matrix.drawPixel(0, 0, matrix.Color333(7, 7, 7));
delay(500);
// whew!
}
void loop() {
// do nothing
}
2013年07月07日 07点07分 3
level 1
这东西还是去极客工坊问吧 里面人很多高手也多
2013年10月21日 11点10分 4
1