source: rtos_arduino/trunk/arduino_lib/hardware/arduino/samd/libraries/EnergySaving/examples/TianMIPSOnOff/TianMIPSOnOff.ino@ 224

Last change on this file since 224 was 224, checked in by ertl-honda, 8 years ago

1.7.10のファイルに更新

File size: 1.3 KB
Line 
1/*
2
3This sketch allows the users to manage the Tian power management.
4Users can power up or power down the MIPS side from the MCU serial console.
5
6After upload the sketch, open the Serial Terminal and press the send button.
7
8COMMANDS
9----------------------
10h - help
11D - power down MIPS
12U - power up MIPS
13
14created March 2016
15 by andrea@arduino.org
16
17 */
18
19#define MIPS_PIN 32 //PA28 PIN 32
20
21char var;
22
23void setup() {
24 // put your setup code here, to run once:
25 Serial.begin(115200);
26
27 pinMode(MIPS_PIN,OUTPUT); //MIPS
28 digitalWrite(MIPS_PIN,HIGH);
29 while(!Serial.available());;
30 menu('h');
31}
32
33void loop() {
34 // put your main code here, to run repeatedly:
35 while (Serial.available()){
36 var = Serial.read();
37 menu(var);
38 }
39}
40
41void menu( char var){
42 switch (var) {
43 case 'D':
44 Serial.println("MIPS OFF");
45 Serial.println();
46 digitalWrite(MIPS_PIN,LOW);
47 break;
48 case 'U':
49 Serial.println("MIPS ON");
50 Serial.println();
51 digitalWrite(MIPS_PIN,HIGH);
52 break;
53 case 'h':
54 Serial.println("COMMANDS");
55 Serial.println("----------------------");
56 Serial.println("h - help");
57 Serial.println("D - power down MIPS");
58 Serial.println("U - power up MIPS");
59 Serial.println();
60 break;
61 }
62
63}
Note: See TracBrowser for help on using the repository browser.