#include <M5Stack.h>
#include <ArtnetWifi.h>
// Artnet settings
ArtnetWifi artnet;
constint startUniverse = 32767; // CHANGE FOR YOUR SETUP most software this is 1, some software send out artnet first universe as 0.constchar broadcastHost[] = "2.255.255.255"; // CHANGE FOR YOUR SETUP your destinationconstchar unicastHost[] = "2.21.21.1"; // CHANGE FOR YOUR SETUP your destinationconstchar* ssid = "ssid"; // CHANGE FOR YOUR SETUPconstchar* password = "password"; // CHANGE FOR YOUR SETUPboolean ConnectWifi(constchar* ssid,constchar* password);
int ThirdMenu(int firstMenuSelectNum, int artnetSendFlag){
if(artnetSendFlag == 0){
ConnectWifi(ssid,password);
if(firstMenuSelectNum == 0){
artnet.begin(broadcastHost);
}elseif(firstMenuSelectNum == 1){
artnet.begin(unicastHost);
}else{
//
}
artnet.setLength(3);
artnet.setUniverse(startUniverse);
M5.Lcd.setCursor(0, 50);
M5.Lcd.setTextSize(2);
M5.Lcd.setTextColor(GREEN);
M5.Lcd.print("Please push the C button");
delay(2000);
artnetSendFlag = 1;
}else{
//
}
return artnetSendFlag = 1;
}
void drawLine(){
int start_x = 0;
int start_y = 100;
int max_x = 320;
int max_y = 240;
M5.Lcd.fillRect(start_x,start_y,max_x - start_x, max_y - start_y,BLACK);
for(int y = start_y; y < max_y ; y += 10){
M5.Lcd.drawLine(start_x,start_y,max_x - 1,y,0x7BE0);
delay(10);
}
}
void ThirdSelectButton(){
if(M5.BtnC.wasPressed()){//一行目が選択されている状態なら
M5.Lcd.clear();
M5.Lcd.setCursor(0, 50);
M5.Lcd.setTextColor(RED);
M5.Lcd.print("Art-Net Sending..");
// set the first 3 byte to all the same value. A RGB lamp will show a ramp-up white.for (uint8_t j = 0; j < 255; j++) {
for (uint8_t i = 0; i < 3; i++) {
artnet.setByte(i, j);
}
artnet.write();
}
drawLine();
}elseif(M5.BtnA.wasPressed()){//二行目が選択されている状態なら
M5.Lcd.clear();
M5.Lcd.setCursor(0, 50);
M5.Lcd.setTextColor(0xB7E0);
M5.Lcd.print("Art-Net Stopped");
}else{
//
}
}