A twist to the computer that landed man on the moon. More information can be found at http://hackaday.io/project/294-Open-Source-DSKY
Dependencies: DS1302 keypad mbed
main.cpp
- Committer:
- VivaPenguinos
- Date:
- 2014-02-16
- Revision:
- 0:3ff58b093415
- Child:
- 1:24446776f0d2
File content as of revision 0:3ff58b093415:
/* Introduction Arduino DSKY This is a personal project used developed by penguinos to mix old school technology with a modern twist. Version 0.01: Feb. 4 2014 Switch platforms from Arduino to KL25Z by Freescale. Because of this, Revision number is resetted. Major Revision to Code are being undertaken. Notable Credits: NASA! - Release of technical documentations regarding the AGC and DSKY Ron Burkley and Contributers of "Virtual AGC — AGS — LVDC — Gemini" - Providing Technical documentations, Source Code, explanations, and refrences on other sites to make this project successful Warning: This may contain author crude language, random memes, and random thoughts. */ using namespace std; #include "mbed.h" //Declare Variables int shift = 0; // Shift Data // In the Arduino Version it uses a String. Will use an Int instead to see if this works on Mbed int Verb; int Noun; int Enter; int Set_GET_Seconds = 30; // Configure the Set Get in seconds. 1/100th of a second char Set_get_miliseconds = 10; char Set_Get_Seconds_Byte = 0; char Set_Get_Seconds_Byte2 = 0; char data = 0; char data2 = 0; char data3 = 0; char nibble[10] = // Holds variables for nibbles for number 0-9 in hexes. nibble ALL the things! {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09}; // Function Declaration void blinkAll(int amount, int delay);// Function that Blinks all LED //void ShiftingOut(char myDataOut); // Pin modes for each pins DigitalOut LatchPin(PTD4); //Pin for ST_CP of 74HC595 Pin # 12 DigitalOut ClockPin(PTA12); //Pin for SH_CP of 74HC595 Pin # 11 DigitalOut DataPin(PTA4); //Pin for to DS of 74HC595 Pin # 14 DigitalOut myled(LED1); Serial pc(USBTX, USBRX); // tx, rx Serial Output to PC Enabling this WILL consume resources. Use only for debug int main() { wait(1); pc.printf("Shifting"); blinkAll(4,1); pc.printf("Done"); wait(1); /* //Serial pc(USBTX, USBRX); // tx, rx Serial Output to PC Enabling this WILL consume resources. Use only for debug while(1) { //pc.printf("on"); myled = 1; wait(1); //pc.printf("off"); myled = 0; wait(1); } */ return 0; } void compare(int Verb,int Noun, int Enter){ if (Verb == 16 && Noun == 36) { //Configure GET } else if (Verb == 35 && Noun == 100) { // Test Light } else if (Verb == 25 && Noun == 36) { // Configure GET } else if (Verb == 37 && Enter == 00) { // Idle Program } } void ShiftingOut(int myDataOut) { // This shifts 8 bits out to the MSB first, The the rising edge of the clock, while clock idles low. // Internal Fucntions DataPin = 0; ClockPin = 0; int i= 0; int pinState; // Clears Everything within shift registers DataPin = 0; ClockPin = 0; for (i=7; i>= 0; i--) { ClockPin = 0; // Value passed to my data out if ( myDataOut & (1<<i)) { pinState = 1; myled = 1; pc.printf("1"); } else { pinState = 0; myled = 0; pc.printf("0"); } DataPin = pinState; ClockPin = 1; DataPin = 0; } ClockPin = 0; DataPin = 1; } //blinks the whole registered based on the number of times you want to blink with a certain delay void blinkAll(int amount, int delay){ LatchPin = 0; ShiftingOut(0); ShiftingOut(0); LatchPin = 1; wait(0.2); for (int x = 0; x < amount; x++) { LatchPin = 0; pc.printf("sending"); ShiftingOut(255); ShiftingOut(255); ShiftingOut(255); LatchPin = 1; wait(delay); LatchPin = 0; ShiftingOut(0); ShiftingOut(0); ShiftingOut(0); LatchPin = 1; wait(delay); } }