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.
main.cpp
- Committer:
- chibait
- Date:
- 2020-06-26
- Revision:
- 0:53440db43074
File content as of revision 0:53440db43074:
#include "mbed.h"
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
Serial rn42(p13,p14);//TXがP0_13 RXがP0_14で宣言
//Pin setting for Analog input
AnalogIn a(p15);
AnalogIn b(p16);
AnalogIn c(p17);
int main() {
//pc.printf("test\r\n");
pc.baud(9600);
rn42.baud(9600);
myled = 1;
wait(0.2);
myled = 0;
//rn42.printf("test\r\n");
time_t seconds = time(NULL) + (60 * 60 * 9); // JST
struct tm *t = localtime(&seconds);
char buffer[32];
while(1) {
//pc.printf("voltage: %4.5f\r\n", a.read());
//seconds = time(NULL) + (60 * 60 * 9); // JST
//strftime(buffer, 16, "%H:%M:%S", localtime(&seconds));
//rn42.printf("%s,", buffer);
rn42.printf("%s,%4.7f,%4.7f,%4.7f", buffer,a.read(),b.read(),c.read());
//pc.printf("%s,", buffer);
//pc.printf("%4.7f,%4.7f,%4.7f\r\n", a.read(),b.read(),c.read());
//wait(0.5);
}
}