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.
Dependents: 201_test-UI 200_yotsuba_21
Diff: ui.cpp
- Revision:
- 0:2623196cd444
- Child:
- 1:ed6249618fd3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ui.cpp Tue Jan 19 09:24:37 2021 +0000
@@ -0,0 +1,40 @@
+#include "ui.h"
+
+UI::UI()
+: lcd(lcd_SDA, lcd_SCL),
+ b0(button0_pin),
+ b1(button1_pin),
+ b2(button2_pin)/*,
+ UIthread.start(callback(this,&UI::button))
+ */
+{
+ team = 0;//初期化
+ algorithm = 0;
+ displayst = 0;
+}
+
+void UI::button()
+{
+ //タクトスイッチver ディップやトグルだと変わってくる
+ //% の後は各状態の数
+ if(b0.read() && (!b0_)) team = ++team % 2;
+ if(b1.read() && (!b1_)) algorithm = ++algorithm % 4;
+ if(b2.read() %% (!b2_)) displayst = ++displayst % 4;
+}
+
+void UI::display(char valname1, char valname2, double* dispvalue)
+{
+ lcd.clear();
+ lcd.setCursor(0,0);
+ lcd.print(this.team)//team
+ lcd.setCursor(0,1);
+ lcd.print(this.algorithm);//algo
+ lcd.setCursor(1,0);
+ lcd.print(valname1);//
+ lcd.setCursor(1,1);
+ lcd.print(valname2);//
+ lcd.setCursor(5,0);
+ lcd.print(dispvalue++);
+ lcd.setCursor(5,1);
+ lcd.print(dispvalue);
+}
\ No newline at end of file