Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of forcesensor_v1 by
Revision 1:0d358560594b, committed 2017-03-29
- Comitter:
- DimpleB05
- Date:
- Wed Mar 29 07:38:23 2017 +0000
- Parent:
- 0:811dd69a17ee
- Commit message:
- forcesensor_mbedcode;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Mar 03 09:12:55 2017 +0000 +++ b/main.cpp Wed Mar 29 07:38:23 2017 +0000 @@ -4,19 +4,24 @@ AnalogIn in(A0); Serial pc(USBTX, USBRX); +Ticker tmr; + int in_value=0; float voltage = 0; +void read_adc () +{ + in_value = in.read_u16()>> 4; + pc.printf("%d\n",in_value); +} + int main() { pc.baud(BAUDRate); - pc.printf("Clock speed: %d\r\n", SystemCoreClock); + tmr.attach(&read_adc, 0.01); while(1) { - - in_value = in.read_u16()>>4; - voltage = (in_value * 3.3)/4096; - pc.printf("%d,%f\r\n",in_value, voltage); - wait(1); + //; + } } \ No newline at end of file