voor lennart
Dependencies: mbed ADS1015 USBDevice
main.cpp
- Committer:
- RoelvdPlas
- Date:
- 2019-01-16
- Revision:
- 0:ce39f1aa5d6e
- Child:
- 1:45df6a3a9a2c
File content as of revision 0:ce39f1aa5d6e:
//Including the needed libraries #include "mbed.h" #include "Adafruit_ADS1015.h" #include "USBSerial.h" #include "windows.h" //Not sure if we need those? #define SERIAL_BAUD_RATE 115200 #define ADC_MAX_VALUE 2048 //Defining the I2C and Serial port connections I2C i2c(p28,p27); Serial pc(USBTX, USBRX); //Defining the goto adress for the ADC Adafruit_ADS1115 adc(&i2c, 0x48); Adafruit_ADS1115 adc2(&i2c, 0x49); //Setting i2c frequency and baudrate int i2c__frequency = 100000; int baud_rate = 115200; //Declair var int ledPin = 1; int averageFSR[8]; int averagePE[6]; int i = 0; Timer t; void setupLED(){ pinMode(ledPin, OUTPUT); } void piepLong(){ digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(ledPin, LOW); } void piepShort(int x){ for(int i=1; i<=x; i++){ digitalWrite(ledPin, HIGH); delay(500); digitalWrite(ledPin, LOW); delay(500); } } void delaySeconds(int x){ int timeMiliSeconds = x * 1000; delay(timeMiliSeconds) } int main() { pc.usb.baud(baud_rate); pc.printf( “To start test press a key \n \n When you have pressed enter, a 5 second countdown will begin. After this countdown, the test will begin. \n \n You have to follow the pattern listed below 10 times: \r 1. Right side \n 2. Back \n 3. Left side \n 4. Out of bed \n \n A long PIEEP indicates you to switch to the next position on the list, you have 5 seconds to switch. \n Two short PIEP’s indicates you to that the measurement has begun. Do not move during this period of 15 seconds. \n Three long PIEEEEP’s will indicate you that the test has finished. \n \n Good luck!”); if getc{ piepShort(5); //5 seconds countdown for(int i=1; i<=10; i++){ //10 times loop piepLong(); //right side signal delaySeconds(5); //time for turning piepShort //collect data } } return 0; }