和朋友們一起打球會不會經(jīng)常遇到忘記分?jǐn)?shù)的情況,能夠?qū)P拇蚯蚨挥梅中氖且患嗝磹芤獾氖虑,有一塊屬于自己場地的記分牌在吸引眼球的同時也能讓朋友們更專心認(rèn)真的打球。那就讓我們來發(fā)揚(yáng)極客精神,自己動手做一個吧!
123236c4m4d00rd9smddme.jpg (193.68 KB, 下載次數(shù): 186)
下載附件
2016-4-11 02:56 上傳
123246y6uvegojdtu6wowm.jpg (172 KB, 下載次數(shù): 208)
下載附件
2016-4-11 02:56 上傳
這臺“基于arduino的紅外遙控比賽記分器”采用arduino UNO 、四塊8*8紅色點(diǎn)陣模塊和紅外遙控接收模塊組成,可以通過紅外線遙控器更新比賽分?jǐn)?shù)和設(shè)置發(fā)球方,遙控有效距離不小于10米,可由一個隨身電源供電。
硬件使用MAX7219點(diǎn)陣模塊作為顯示輸出,采用級聯(lián)接法,使用Max72xxPanel和Adafruit_GFX庫驅(qū)動,輕松實(shí)現(xiàn)多種組合輸出。具體接線方法在附件的代碼中有描述,或請參考論壇內(nèi)其它相關(guān)帖子。
123307ldiz98j8au0ikipj.jpg (210.29 KB, 下載次數(shù): 172)
下載附件
2016-4-11 02:56 上傳
此記分器經(jīng)過羽毛球場地測試,性能穩(wěn)定,霸氣實(shí)用,獲得一致好評,希望愛折騰的你能將它應(yīng)用于其它運(yùn)動,謝謝。 全部制作資料及源碼下載:
score.rar
(83.43 KB, 下載次數(shù): 11)
2016-4-11 01:44 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
部分源碼預(yù)覽:
- int RECV_PIN = A0;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- int pinCS = 10; // Attach CS to this pin, DIN to MOSI and CLK to SCK (cf [url]http://arduino.cc/en/Reference/SPI[/url] )
- int numberOfHorizontalDisplays = 4;
- int numberOfVerticalDisplays = 1;
- int pinRightPlus = 4;
- int pinRightReduce = 5;
- int pinLeftPlus = 6;
- int pinLeftReduce = 7;
- unsigned long leftPlusCode = 0xFD807F;
- unsigned long LeftReduceCode = 0xFDA05F;
- unsigned long rightPlusCode = 0xFD40BF;
- unsigned long rightReduceCode = 0xFD609F;
- unsigned long resetCode = 0xFD00FF;
- unsigned long fireChg = 0xFD20DF;
- Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays);
- int leftScore=0;
- int rightScore=0;
- uint8_t whoFire = 0; //0:none,1:left,2:right
- void setup() {
- pinMode(pinRightPlus, INPUT);
- pinMode(pinRightReduce, INPUT);
- pinMode(pinLeftPlus, INPUT);
- pinMode(pinLeftReduce, INPUT);
- matrix.setIntensity(1); // Use a value between 0 and 15 for brightness
- //Serial.begin(9600);
- irrecv.enableIRIn(); // Start the receiver
- }
- void checkIR()
- {
- if (irrecv.decode(&results)) {
- //Serial.println(results.value, HEX);
-
- if (results.value==leftPlusCode)
- {
- leftScore++;
- if(leftScore>99)
- {
- leftScore=99;
- }
- whoFire=1;
- }
- else if(results.value==fireChg)
- {
- //0:none,1:left,2:right
- if(whoFire==0)
- {
- whoFire=1;
- }
- else if(whoFire==1)
- {
- whoFire=2;
- }
- else if(whoFire==2)
- {
- whoFire=1;
- }
- }
- else if(results.value==LeftReduceCode )
- {
- leftScore--;
- if(leftScore<0)
- {
- leftScore=0;
- }
- }
- else if(results.value==rightPlusCode )
- {
- rightScore++;
- if(rightScore>99)
- {
- rightScore=99;
- }
- whoFire=2;
- }
- else if(results.value==rightReduceCode )
- {
- rightScore--;
- if(rightScore<0)
- {
- rightScore=0;
- }
- }
- else if(results.value==resetCode )
- {
- leftScore=0;
- rightScore=0;
- whoFire=0;
- }
- irrecv.resume(); // Receive the next value
- }
- }
- void loop() {
- checkIR();
- drawScreen();
- delay(400);
- }
- void drawScreen()
- {
- matrix.fillScreen(LOW);
- drawLeftScore();
- drawRightScore();
- drawArr();
- matrix.write(); // Send bitmap to display
- }
- void drawArr()
- {
- //0:none,1:left,2:right
- if(whoFire == 1)
- {
- matrix.drawPixel(0, 3, HIGH);
- matrix.drawLine(1, 2, 1, 4, HIGH);
- matrix.drawLine(2, 1, 2, 5, HIGH);
- }
- else if(whoFire == 2)
- {
- matrix.drawPixel(31, 3, HIGH);
- matrix.drawLine(30, 2, 30, 4, HIGH);
- matrix.drawLine(29, 1, 29, 5, HIGH);
- }
- }
- void drawLeftScore()
- {
- uint8_t score10 = leftScore/10;
- uint8_t score1 = leftScore%10;
- matrix.drawChar(4, 0,score10+48, HIGH, LOW, 1);
- matrix.drawChar(10, 0,score1+48, HIGH, LOW, 1);
- }
- void drawRightScore()
- {
- uint8_t score10 = rightScore/10;
- uint8_t score1 = rightScore%10;
- matrix.drawChar(17, 0,score10+48, HIGH, LOW, 1);
- matrix.drawChar(23, 0,score1+48, HIGH, LOW, 1);
- }
復(fù)制代碼
|