PIC32-Pinguino

07.03.2013

pinguino scr


Linkkej: hacktronics.com (ohje jota kytin), instructables.com, arduino.cc (Reference/digitalWrite)

7 Segmenttinyttj on kahta eri tyyppi. "Common Anode"(+ Plussa) ja "Common Cathode"(-GND/Maa/Miinus/Ledien lyhyt jalka). Tmn huomasin vhemmn ylltten kun ptin seurata valmista ohjetta jossa kytetn juuri sit toisenlaista eli Katodi mallia laskemaan yhdeksst nollaan. Tuloksena nytt ei syttynyt. Kun vaihtoi miinuksen jatkuvaksi plussaksi (Digital Pin 0) ohjelman muutoksen avulla ja GND/Maa johdon siirtmisen Digital Pin 0, syttyi nytt mutta viel oli plussat ja minukset  (ykkset ja nollat) vrinpin ohjelmassa/johtoissa kun ei tuottanut selvi numeroita.

pinguino pcr2

1stPinguinoTests.png

Itse ptin vain ohjelmassa knt numerot pinvastoin esim.  0110000 => 1001111.

/*----------------------------------------------------- Author: XantheFIN Date: 24/Dec/2012 Description: Common Anode + (3,8) 7 segment calculator. -----------------------------------------------------*/ // Longer, more obvious example for Arduino 7 segment display // http://www.hacktronics.com/Tutorials/arduino-and-7-segment-led.html // License: http://www.opensource.org/licenses/mit-license.php (Go crazy) void setup() { pinMode(0, OUTPUT); // Common anode pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); pinMode(7, OUTPUT); //Middle line pinMode(8, OUTPUT); pinMode(9, OUTPUT); // Dot } void loop() { // write 'On' digitalWrite(0, 1); // Common anode on digitalWrite(9, 1); // Dot off // write '9' digitalWrite(2, 0); digitalWrite(3, 0); digitalWrite(4, 0); digitalWrite(5, 1); digitalWrite(6, 1); digitalWrite(7, 0); digitalWrite(8, 0); delay(1000); // write '8' digitalWrite(2, 0); digitalWrite(3, 0); digitalWrite(4, 0); digitalWrite(5, 0); digitalWrite(6, 0); digitalWrite(7, 0); digitalWrite(8, 0); delay(1000); // write '7' digitalWrite(2, 0); digitalWrite(3, 0); digitalWrite(4, 0); digitalWrite(5, 1); digitalWrite(6, 1); digitalWrite(7, 1); digitalWrite(8, 1); delay(1000); // write '6' digitalWrite(2, 0); digitalWrite(3, 1); digitalWrite(4, 0); digitalWrite(5, 0); digitalWrite(6, 0); digitalWrite(7, 0); digitalWrite(8, 0); delay(1000); // write '5' digitalWrite(2, 0); digitalWrite(3, 1); digitalWrite(4, 0); digitalWrite(5, 0); digitalWrite(6, 1); digitalWrite(7, 0); digitalWrite(8, 0); delay(1000); // write '4' digitalWrite(2, 1); digitalWrite(3, 0); digitalWrite(4, 0); digitalWrite(5, 1); digitalWrite(6, 1); digitalWrite(7, 0); digitalWrite(8, 0); delay(1000); // write '3' digitalWrite(2, 0); digitalWrite(3, 0); digitalWrite(4, 0); digitalWrite(5, 0); digitalWrite(6, 1); digitalWrite(7, 1); digitalWrite(8, 0); delay(1000); // write '2' digitalWrite(2, 0); digitalWrite(3, 0); digitalWrite(4, 1); digitalWrite(5, 0); digitalWrite(6, 0); digitalWrite(7, 1); digitalWrite(8, 0); delay(1000); // write '1' digitalWrite(2, 1); digitalWrite(3, 0); digitalWrite(4, 0); digitalWrite(5, 1); digitalWrite(6, 1); digitalWrite(7, 1); digitalWrite(8, 1); delay(1000); // write '0' digitalWrite(2, 0); digitalWrite(3, 0); digitalWrite(4, 0); digitalWrite(5, 0); digitalWrite(6, 0); digitalWrite(7, 0); digitalWrite(8, 1); delay(1000); // write 'Off' digitalWrite(2, 1); digitalWrite(3, 1); digitalWrite(4, 1); digitalWrite(5, 1); digitalWrite(6, 1); digitalWrite(7, 1); digitalWrite(8, 0); digitalWrite(9, 0); delay(3000); }

Tiedosto: *.pde

Itse koin jo pienen oppimisen makua kuin taas vertaa Ledin vilkkumiseen...

---Vieraskirja---

Web Analytics Clicky