http://www.geek-workshop.com/thread-101-1-1.html
http://freegezi.net/blog/2011/12/317
skip to main |
skip to sidebar
** Device: Joystick **
** File: EF_Joystick_Test.c **
** **
** Created by ElecFreaks Robi.W /10 June 2011 **
** **
** Description: **
** This file is a sample code for your reference. **
** **
** Copyright (C) 2011 ElecFreaks Corp. **
*********************************************************************/
iint FirstShotX , FirstShotY;
void setup()
{
for(int i=0; i<19; i++)
{
pinMode(i, INPUT);
digitalWrite(i, 1);
}
Serial.begin(9600);
FirstShotX = 0;
FirstShotY = 0;
}
void loop(){
int i, someInt, flag = 0;
for(i=4; i<11; i++)
{
someInt = digitalRead(i);
if(someInt == 0)
{
flag =1;
break;
}
}
if(flag == 1)
{
switch(i)
{
case 4: Serial.println("--------> Button A"); break;
case 5: Serial.println("--------> Button B"); break;
case 6: Serial.println("--------> Button C"); break;
case 7: Serial.println("--------> Button D"); break;
case 8: Serial.println("--------> Button E"); break;
case 9: Serial.println("--------> Button F"); break;
case 10: Serial.println("--------> Button KEY"); break;
default: break;
}
flag=0;
}
int sensorValue = analogRead(A0);
if(FirstShotX == 0)
{
FirstShotX = sensorValue;
Serial.print("FirstShotX = ");
Serial.println(FirstShotX);
}
Serial.print("X = ");
Serial.println(sensorValue - FirstShotX);
sensorValue = analogRead(A1);
if(FirstShotY == 0)
{
FirstShotY = sensorValue;
Serial.print("FirstShotY = ");
Serial.println(FirstShotY);
}
Serial.print("Y = ");
Serial.println(sensorValue - FirstShotY);
delay(200);
}
學習 Arduino 的筆記
使用 Arduino 遙控家電
http://www.makezine.com.tw/2012/12/17/%E4%BD%BF%E7%94%A8-arduino-%E9%81%99%E6%8E%A7%E5%AE%B6%E9%9B%BB/
ArduBlock - Arduino圖像化編程
http://blog.ardublock.com/engetting-started-ardublockzhardublock/
http://blog.sina.com.cn/s/blog_69bcf45201016i59.html
http://blog.sina.com.cn/s/blog_69bcf45201016i59.html
Arduino PS2搖杆 遊戲搖杆模塊 Joystick 模塊
Arduino 測試實例Demo
/*********************************************************************** Device: Joystick **
** File: EF_Joystick_Test.c **
** **
** Created by ElecFreaks Robi.W /10 June 2011 **
** **
** Description: **
** This file is a sample code for your reference. **
** **
** Copyright (C) 2011 ElecFreaks Corp. **
*********************************************************************/
iint FirstShotX , FirstShotY;
void setup()
{
for(int i=0; i<19; i++)
{
pinMode(i, INPUT);
digitalWrite(i, 1);
}
Serial.begin(9600);
FirstShotX = 0;
FirstShotY = 0;
}
void loop(){
int i, someInt, flag = 0;
for(i=4; i<11; i++)
{
someInt = digitalRead(i);
if(someInt == 0)
{
flag =1;
break;
}
}
if(flag == 1)
{
switch(i)
{
case 4: Serial.println("--------> Button A"); break;
case 5: Serial.println("--------> Button B"); break;
case 6: Serial.println("--------> Button C"); break;
case 7: Serial.println("--------> Button D"); break;
case 8: Serial.println("--------> Button E"); break;
case 9: Serial.println("--------> Button F"); break;
case 10: Serial.println("--------> Button KEY"); break;
default: break;
}
flag=0;
}
int sensorValue = analogRead(A0);
if(FirstShotX == 0)
{
FirstShotX = sensorValue;
Serial.print("FirstShotX = ");
Serial.println(FirstShotX);
}
Serial.print("X = ");
Serial.println(sensorValue - FirstShotX);
sensorValue = analogRead(A1);
if(FirstShotY == 0)
{
FirstShotY = sensorValue;
Serial.print("FirstShotY = ");
Serial.println(FirstShotY);
}
Serial.print("Y = ");
Serial.println(sensorValue - FirstShotY);
delay(200);
}
Arduino Ethernet WITHOUT PoE
Arduino Ethernet 網路控制器(無掛POE)本身結合arduino與ethernet+SD卡的功能於一身 與arudino一樣同樣擁有 14組數位IO
6組類比輸入(其中10.11.12.13如使用ethernet會被占用)
而POE指的是-->power of ethernet, 也就是網路線供電的裝置, 如有需要可以考慮另一款的產品 Arduino Ethernet WITH PoE 注意: 此款產品如要更新程式 需搭配USBtoTTL5V的燒錄器(訊號轉換裝置)
Ethernet的使用透過SPI訊號-->10.11.12.13
SD卡的使用也透過SPI訊號-->4.11.12.13
藉由SPI訊號中的SS腳位(slave select)的觸發來處理~
http://www.aroboto.com/shop/goods.php?id=506
6組類比輸入(其中10.11.12.13如使用ethernet會被占用)
而POE指的是-->power of ethernet, 也就是網路線供電的裝置, 如有需要可以考慮另一款的產品 Arduino Ethernet WITH PoE 注意: 此款產品如要更新程式 需搭配USBtoTTL5V的燒錄器(訊號轉換裝置)
Ethernet的使用透過SPI訊號-->10.11.12.13
SD卡的使用也透過SPI訊號-->4.11.12.13
藉由SPI訊號中的SS腳位(slave select)的觸發來處理~
http://www.aroboto.com/shop/goods.php?id=506