Arduino
/*******************************************************
* name:Joystick PS2
* function:push the joystick and the coordinates of X and Y axes displayed on Serial Monitor will change accordingly;
* press down the joystick, and the coordingly of Z=0 will also be displayed.
* connection:
* Joystick PS2 Arduino Uno R3
* GND GND
* VCC 5V
* SW 7
* x A0
* Y A1
* ******************************************************/
const int xPin = A0; //X attach to A0
const int yPin = A1; //Y attach to A1
const int btPin = 7; //Bt attach to digital 7
void setup()
{
pinMode(btPin, INPUT);
digitalWrite(btPin, HIGH);
Serial.begin(9600);
}
void loop()
{
Serial.print("X: "
最后
以上就是留胡子小蝴蝶最近收集整理的关于arduino 操纵杆_【树莓派+arduino实验记录11 】操纵杆传感器的全部内容,更多相关arduino内容请搜索靠谱客的其他文章。
发表评论 取消回复