:)
Dependencies: MbedJSONValue DebounceIn TextLCD USBDevice mbed WebSocketClient cc3000_hostdriver_mbedsocket Adafruit_LEDBackpack_2
Revision 10:cfd60b63ed11, committed 2014-12-02
- Comitter:
- ddrew73
- Date:
- Tue Dec 02 23:17:59 2014 +0000
- Parent:
- 9:5fa90677ff3e
- Child:
- 11:b520586dc0a1
- Commit message:
- Here.;
Changed in this revision
| Adafruit_LEDBackpack_2.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Adafruit_LEDBackpack_2.lib Tue Dec 02 20:07:33 2014 +0000 +++ b/Adafruit_LEDBackpack_2.lib Tue Dec 02 23:17:59 2014 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/ddrew73/code/Adafruit_LEDBackpack_2/#0491b3f9a639 +http://developer.mbed.org/teams/Interactive-Device-Design/code/Adafruit_LEDBackpack_2/#0491b3f9a639
--- a/main.cpp Tue Dec 02 20:07:33 2014 +0000
+++ b/main.cpp Tue Dec 02 23:17:59 2014 +0000
@@ -22,13 +22,13 @@
Adafruit_24bargraph ledbar_right=Adafruit_24bargraph(&i2c_right);
DebounceIn upbutton(PTA16);
-DebounceIn downbutton(PTC17);
-DebounceIn leftbutton(PTC16);
-DebounceIn rightbutton(PTC13);
+DebounceIn downbutton(PTC12);
+DebounceIn leftbutton(PTC17);
+DebounceIn rightbutton(PTC16);
//Scanner stuff
-DebounceIn scanbutton(PTC12);
+DebounceIn scanbutton(PTC13);
DigitalOut A_in(PTB10);
DigitalOut B_in(PTB11);
@@ -46,6 +46,10 @@
//extLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type = LCD16x2);
TextLCD lcd(PTC6,PTC5,D5,D4,D3,D2,TextLCD::LCD20x4);
+
+//WIFI STUFF
+/*
+
// cc3000 KL25Z wifi connection
// we need to define connection pins for:
// - IRQ => (pin D3)
@@ -61,6 +65,9 @@
Websocket ws("ws://sockets.mbed.org/ws/toastboard/rw");
MbedJSONValue demo;
+*/
+
+
int main()
{
@@ -94,14 +101,14 @@
//Display
- if (colselect == 0) {
+ if (colselect == 0 && moved == 1) {
ledbar_left.clear();
ledbar_right.clear();
ledbar_left.setBar(rowselect,LED_GREEN);
ledbar_left.writeDisplay();
ledbar_right.writeDisplay();
}
- else {
+ else if (colselect == 1 && moved == 1) {
ledbar_left.clear();
ledbar_right.clear();
ledbar_right.setBar(rowselect,LED_GREEN);
@@ -177,6 +184,8 @@
for (int x = 0; x < 2; x++) {
for (int y = 0; y < 24; y++) {
+
+
int sn = (colselect+1)*(rowselect+1);
A_in = (sn-1)&2;
B_in = ((sn-1)/2)%2;
@@ -186,6 +195,9 @@
F_in = ((sn-1)/32)%2;
float in_val = adc.read();
+
+
+
volt_mat[x][y] = in_val;
if (x == 1){
@@ -228,6 +240,12 @@
} } //END OF ROWSCAN FOR LOOP
+ selected = rowselect;
+ if (colselect == 1){
+ selected = selected+24;
+ }
+
+ /*
//STUFF INTO JSON FORMAT
char str[1];
for (int i= 0; i < 48; i++) {
@@ -236,29 +254,29 @@
}
demo["vdd"] = vddval;
demo["rowval"] = rowval;
- selected = rowselect;
- if (colselect == 1){
- selected = selected+24;
- }
+
demo["selected"] = selected;
+ */
moved = 0;
+
//DEBUGGING TOOLS //////////////
- pc.printf("\n%1.3f %1.3f \n", vddval, rowval);
+
+ pc.printf("\r\n%1.3f %1.3f \r\n", vddval, rowval);
for (int i = 0; i<48; i++){
pc.printf(" %1.3f ", clientdata[i]);
}
- pc.printf(" \n \n ");
+ pc.printf(" \r\n \r\n ");
for (int x = 0; x < 2; x++) {
for (int y = 0; y < 24; y++) {
- pc.printf("%1.3f \n", volt_mat[x][y]);
+ pc.printf("%1.3f \r\n", volt_mat[x][y]);
}}
////////////////////////
- wait(2); //THIS NEEDS TO GO AWAY! :}
+ wait(1); //THIS NEEDS TO GO AWAY! :}
} // END OF SCANBUTTON IF STATEMENT
@@ -274,7 +292,7 @@
else {
lcd.cls();
string programname = "The ToastBoard";
- string instructions = "Select a row and scan";
+ string instructions = "Select a row";
lcd.locate(0,0);
lcd.printf("%s",programname.c_str());
lcd.locate(0,1);