Skip to content

Instantly share code, notes, and snippets.

@TakehikoShimojima
Last active April 1, 2021 02:07
Show Gist options
  • Save TakehikoShimojima/15f6f8e577d04cfa22596a3d5707f30c to your computer and use it in GitHub Desktop.
Save TakehikoShimojima/15f6f8e577d04cfa22596a3d5707f30c to your computer and use it in GitHub Desktop.
#include <M5StickC.h>
#include <Wire.h>
#include "porthub.h"
PortHub porthub;
uint8_t HUB_ADDR[6]={HUB1_ADDR,HUB2_ADDR,HUB3_ADDR,HUB4_ADDR,HUB5_ADDR,HUB6_ADDR};
void setup() {
M5.begin();
porthub.begin();
M5.Lcd.setTextSize(2);
}
void loop() {
int val[3];
M5.Lcd.fillScreen(BLACK);
for(int i = 0; i < 3; i++) {
val[i] = porthub.hub_a_read_value(HUB_ADDR[i]); // 光センサの値を取得
M5.Lcd.setCursor(10, 10 + 50 * i);
M5.Lcd.print(val[i]);
}
Serial.printf("%d, %d, %d\r\n", val[0], val[1], val[2]);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment