External modules with MapleMini (STM32F103RB)
Dependencies: ADS1015 mbed-MapleMini mbed
Revision 0:93158ca82b67, committed 2016-12-18
- Comitter:
- vargham
- Date:
- Sun Dec 18 14:11:13 2016 +0000
- Commit message:
- Added ADS1115 @ i2c
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ADS1015.lib Sun Dec 18 14:11:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/arve0/code/ADS1015/#aa277517f0ad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Dec 18 14:11:13 2016 +0000 @@ -0,0 +1,44 @@ +/* + Maple Mini (STM32F103RB) peripherals tests + by Mark Peter Vargha +*/ + +#include "MapleMini.h" +#include "mbed.h" +#include "Adafruit_ADS1015.h" + +DigitalOut boardLed(LED1); +Serial serial(PA_2, PA_3); +I2C i2c(I2C_SDA , I2C_SCL); +Adafruit_ADS1115 ads(&i2c); +Ticker oneSecondTicker; + +void readAds() +{ + serial.printf("External analog in\r\n"); + for (int i = 0; i < 4; i++) + { + int16_t adv = ads.readADC_SingleEnded(i); + serial.printf("ADC%d=%+06d\r\n", i, adv); + } + serial.printf("\r\n"); +} + +void inEverySecond() +{ + readAds(); +} + +int main() +{ + confSysClock(); + serial.baud(115200); + ads.setGain(GAIN_ONE); + oneSecondTicker.attach(&inEverySecond, 1.0); + serial.printf("Maple peripherals tests.\r\n"); + + while(1) + { + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-MapleMini.lib Sun Dec 18 14:11:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/hudakz/code/mbed-MapleMini/#83926b51ca68
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Dec 18 14:11:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/faff56e089b2 \ No newline at end of file