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.
Dependencies: MODSERIAL SDFileSystemSeth mbed
Fork of Opstellingbachelor_opdracht by
Diff: main.cpp
- Revision:
- 3:b525b7a56553
- Parent:
- 2:5c856ceaea2e
- Child:
- 4:afab0fda2cf4
--- a/main.cpp Sun Sep 04 18:47:55 2016 +0000 +++ b/main.cpp Wed Sep 28 20:06:02 2016 +0000 @@ -8,15 +8,10 @@ //////////////////////////////////////////////////////////////////////////////// // Thermocouple pin declarations -DigitalOut SCK_1(2); -DigitalOut CS_1(3); - -int pins[12] = {4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16}; +DigitalOut SCK_1(D0); // sck pin of thermocouples +DigitalOut CS_1(D1); // chip select pin of thermocouples -for (int i = 0; i <= 11; i++) -{ - DigitalOut(pins[i], INPUT); -} +DigitalIn pins[12]={D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13}; //thermocouples 1 - 12 select corresponding pin numbers mbed double d; int b[12] = { }; @@ -85,7 +80,7 @@ SCK_1 = 0; SCK_1 = 1; for (int j = 0; j <= 11; j++) { - if (digitalRead(pins[j])) { + if (pins[j]) { b[j] |= (1 << i); } } @@ -101,7 +96,7 @@ d = b[j] / 16.0 * 100.0; b[j] = d; } - fprintf(fp, "%.3f\t", b[j]); + fprintf(fp, "%.3d\t", b[j]); } fprintf(fp, "\n\r"); @@ -165,9 +160,8 @@ while(1) { fcs_read = fcs.read(); // capture torque sensor data fprintf(fp, "%.3f\t", fcs_read); // output data to file - readTC(b); // call function to read thermocouple data + readTC(); // call function to read thermocouple data } - break; } break;