a

Dependencies:   BraccialeSlave FTHR_OLED

Files at this revision

API Documentation at this revision

Comitter:
gandhi4
Date:
Mon Feb 25 21:15:43 2019 +0000
Parent:
10:1f5e78dd4a7c
Commit message:
a

Changed in this revision

Adafruit_FeatherOLED.lib Show annotated file Show diff for this revision Revisions of this file
Lcd_128x32_1.lib Show annotated file Show diff for this revision Revisions of this file
USBDevice.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
max32630fthr.lib Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 1f5e78dd4a7c -r 9e3dca611315 Adafruit_FeatherOLED.lib
--- a/Adafruit_FeatherOLED.lib	Wed Feb 08 00:50:27 2017 +0000
+++ b/Adafruit_FeatherOLED.lib	Mon Feb 25 21:15:43 2019 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/switches/code/Adafruit_FeatherOLED/#a267f00528be
+https://os.mbed.com/users/gandhi4/code/BraccialeSlave/#e5d8d6e7fac5
diff -r 1f5e78dd4a7c -r 9e3dca611315 Lcd_128x32_1.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Lcd_128x32_1.lib	Mon Feb 25 21:15:43 2019 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/switches/code/FTHR_OLED/#1f5e78dd4a7c
diff -r 1f5e78dd4a7c -r 9e3dca611315 USBDevice.lib
--- a/USBDevice.lib	Wed Feb 08 00:50:27 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/#c5e178adb138
diff -r 1f5e78dd4a7c -r 9e3dca611315 main.cpp
--- a/main.cpp	Wed Feb 08 00:50:27 2017 +0000
+++ b/main.cpp	Mon Feb 25 21:15:43 2019 +0000
@@ -1,112 +1,49 @@
-/**********************************************************************
-* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice shall be included
-* in all copies or substantial portions of the Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
-* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-* OTHER DEALINGS IN THE SOFTWARE.
-*
-* Except as contained in this notice, the name of Maxim Integrated
-* Products, Inc. shall not be used except as stated in the Maxim Integrated
-* Products, Inc. Branding Policy.
-*
-* The mere transfer of this software does not imply any licenses
-* of trade secrets, proprietary technology, copyrights, patents,
-* trademarks, maskwork rights, or any other form of intellectual
-* property whatsoever. Maxim Integrated Products, Inc. retains all
-* ownership rights.
-**********************************************************************/
+#include "mbed.h"
+#include "Adafruit_SSD1306.h"
+Serial bluetooth(D1, D0); // RX TX 
+I2C i2c(D4, D5); // SDA, SCL
+DigitalOut vibMotor(D10);
+Serial pc(USBTX, USBRX);
 
-#include "mbed.h"
-#include "max32630fthr.h"
-#include "Adafruit_SSD1306.h"
-#include "USBSerial.h"
-
-MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
-
-I2C i2c(P3_4, P3_5); // SDA, SCL
-
-// Hardware serial port over DAPLink
-Serial daplink(P2_1, P2_0);
-
-// Virtual serial port over USB
-USBSerial microUSB;
-
-DigitalOut rLED(LED1);
-DigitalOut gLED(LED2);
-DigitalOut bLED(LED3);
-
-DigitalIn aButton(P5_3, PullUp);
-DigitalIn bButton(P3_3, PullUp);
-DigitalIn cButton(P3_2, PullUp);
-
-/* Analog inputs 0 and 1 have internal dividers to allow measuring 5V signals  
- * The dividers are selected by using inputs AIN_5 and AIN_5 respectively.
- * The full scale range for AIN0-3 is 1.2V
- * The full scale range for AIN4-5 is 6.0V
- */
-AnalogIn ain0(AIN_4); 
-AnalogIn ain1(AIN_5); 
-AnalogIn ain2(AIN_2); 
-AnalogIn ain3(AIN_3);
-
-
-// main() runs in its own thread in the OS
-// (note the calls to Thread::wait below for delays)
 int main()
 {
-    int c;
-    c = ' ';
-
-    daplink.printf("daplink serial port\r\n");
-    microUSB.printf("micro USB serial port\r\n");
-    rLED = LED_ON;
-    gLED = LED_ON;
-    bLED = LED_OFF;
-
-
-    Thread::wait(50);  // Give the supplies time to settle before initializing the display
-    Adafruit_SSD1306_I2c featherOLED(i2c);  
-    featherOLED.printf("%ux%u OLED Display\r\n", featherOLED.width(), featherOLED.height());
-    featherOLED.printf("HelloWorld \r");
-    featherOLED.display();
-
+    Adafruit_SSD1306_I2c LCD(i2c);  
+    LCD.display();
+    char bt_received;
+    pc.baud(115200);
+    bluetooth.baud(38400);
 
     while(1) {
-        Thread::wait(250);
-        if (microUSB.readable()) {
-            c = microUSB.getc();
-            microUSB.putc(c);
-            daplink.putc(c);
-        }
-        if (daplink.readable()) {
-            c = daplink.getc();
-            microUSB.putc(c);
-            daplink.putc(c);
-        }
-        rLED = aButton;
-        gLED = bButton;
-        bLED = cButton;
-        featherOLED.clearDisplay();
-        featherOLED.setTextCursor(0,0);
-        featherOLED.printf("MAX32630FTHR OLED\n");
-        featherOLED.printf("AIN0/1: %1.2f, %1.2f\n", (6.0f * ain0), (6.0f * ain1) );  // analog inputs 0,1
-        featherOLED.printf("AIN2/3: %1.2f, %1.2f\n", (1.2f * ain2), (1.2f * ain3) );  // analog inputs 2,3
-        featherOLED.printf("UART:%c  A:%d  B:%d  C:%d\n", c, aButton.read(), bButton.read(), cButton.read());  // UART and Buttons
-        featherOLED.display();
+        while (bluetooth.readable()){
+           LCD.begin();
+           LCD.display();  
+           bt_received = bluetooth.getc();
+           pc.printf("Dato Ricevuto: %c\r\n",bt_received);
+            if (bt_received=='D'){
+                    pc.printf("If \r\n");
+                    LCD.setTextCursor(0,0);
+                    LCD.printf("Bussano alla porta    \n");
+                    vibMotor = 1;
+                    LCD.display();
+                  }
+            else if (bt_received=='P'){
+                    pc.printf("else if \r\n");
+                    LCD.setTextCursor(0,0);
+                    LCD.printf("Bussano al portoncino\n");
+                    vibMotor = 1;
+                    LCD.display();
+                  }
+            else {
+                    pc.printf("Cancella tutto \r\n");
+                    LCD.setTextCursor(0,0);
+                    LCD.printf("                        \n");
+                    vibMotor = 0;
+                    LCD.display();
+                  }
+                 wait_ms(800); 
+
+           }
+
 
     }
 }
diff -r 1f5e78dd4a7c -r 9e3dca611315 max32630fthr.lib
--- a/max32630fthr.lib	Wed Feb 08 00:50:27 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://developer.mbed.org/teams/MaximIntegrated/code/max32630fthr/#60997adf01a2
diff -r 1f5e78dd4a7c -r 9e3dca611315 mbed-os.lib
--- a/mbed-os.lib	Wed Feb 08 00:50:27 2017 +0000
+++ b/mbed-os.lib	Mon Feb 25 21:15:43 2019 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#269f58d75b752a4e67a6a2d8c5c698635ffd6752
+https://github.com/ARMmbed/mbed-os/#ae6c7c60f91c89cbf755a2f3c8ec9c66635849fd