Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Naya Lee
Published

Multi-climate simulation system

It can bring you an immersive experience of different climate changes-project by a team of students from Hebei University of Technology

IntermediateShowcase (no instructions)5 hours84
Multi-climate simulation system

Things used in this project

Story

Read more

Code

Code

C/C++
#include <ChainableLED.h>
#include <Wire.h>
#include <grove_two_rgb_led_matrix.h>
#include <Grove_LED_Bar.h>
#include <Servo.h>

ChainableLED led4(4, 5, 10);
GroveTwoRGBLedMatrixClass rgbMatrix;
char rgbMatrixShapeData[64] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
char rgbMatrixData[64] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
Grove_LED_Bar groveLedBar(3, 2,0);
Servo servo_9;

ChainableLED led3(3, 4, 10);
float _E5_AD_A3_E8_8A_82;
float _E5_A4_A9_E6_B0_94;
float i;
float j;

void setRgbMatrixShapeData(char c0,char c1,char c2,char c3,char c4,char c5,char c6,char c7,char c8,char c9,char c10,char c11,char c12,char c13,char c14,char c15,char c16,char c17,char c18,char c19,char c20,char c21,char c22,char c23,char c24,char c25,char c26,char c27,char c28,char c29,char c30,char c31,char c32,char c33,char c34,char c35,char c36,char c37,char c38,char c39,char c40,char c41,char c42,char c43,char c44,char c45,char c46,char c47,char c48,char c49,char c50,char c51,char c52,char c53,char c54,char c55,char c56,char c57,char c58,char c59,char c60,char c61,char c62,char c63)
{
rgbMatrixShapeData[0]=c0;
rgbMatrixShapeData[1]=c1;
rgbMatrixShapeData[2]=c2;
rgbMatrixShapeData[3]=c3;
rgbMatrixShapeData[4]=c4;
rgbMatrixShapeData[5]=c5;
rgbMatrixShapeData[6]=c6;
rgbMatrixShapeData[7]=c7;
rgbMatrixShapeData[8]=c8;
rgbMatrixShapeData[9]=c9;
rgbMatrixShapeData[10]=c10;
rgbMatrixShapeData[11]=c11;
rgbMatrixShapeData[12]=c12;
rgbMatrixShapeData[13]=c13;
rgbMatrixShapeData[14]=c14;
rgbMatrixShapeData[15]=c15;
rgbMatrixShapeData[16]=c16;
rgbMatrixShapeData[17]=c17;
rgbMatrixShapeData[18]=c18;
rgbMatrixShapeData[19]=c19;
rgbMatrixShapeData[20]=c20;
rgbMatrixShapeData[21]=c21;
rgbMatrixShapeData[22]=c22;
rgbMatrixShapeData[23]=c23;
rgbMatrixShapeData[24]=c24;
rgbMatrixShapeData[25]=c25;
rgbMatrixShapeData[26]=c26;
rgbMatrixShapeData[27]=c27;
rgbMatrixShapeData[28]=c28;
rgbMatrixShapeData[29]=c29;
rgbMatrixShapeData[30]=c30;
rgbMatrixShapeData[31]=c31;
rgbMatrixShapeData[32]=c32;
rgbMatrixShapeData[33]=c33;
rgbMatrixShapeData[34]=c34;
rgbMatrixShapeData[35]=c35;
rgbMatrixShapeData[36]=c36;
rgbMatrixShapeData[37]=c37;
rgbMatrixShapeData[38]=c38;
rgbMatrixShapeData[39]=c39;
rgbMatrixShapeData[40]=c40;
rgbMatrixShapeData[41]=c41;
rgbMatrixShapeData[42]=c42;
rgbMatrixShapeData[43]=c43;
rgbMatrixShapeData[44]=c44;
rgbMatrixShapeData[45]=c45;
rgbMatrixShapeData[46]=c46;
rgbMatrixShapeData[47]=c47;
rgbMatrixShapeData[48]=c48;
rgbMatrixShapeData[49]=c49;
rgbMatrixShapeData[50]=c50;
rgbMatrixShapeData[51]=c51;
rgbMatrixShapeData[52]=c52;
rgbMatrixShapeData[53]=c53;
rgbMatrixShapeData[54]=c54;
rgbMatrixShapeData[55]=c55;
rgbMatrixShapeData[56]=c56;
rgbMatrixShapeData[57]=c57;
rgbMatrixShapeData[58]=c58;
rgbMatrixShapeData[59]=c59;
rgbMatrixShapeData[60]=c60;
rgbMatrixShapeData[61]=c61;
rgbMatrixShapeData[62]=c62;
rgbMatrixShapeData[63]=c63;
}

void rgbMatrixOnPoint(uint8_t x,uint8_t y,uint8_t c)
{
if(x<0||x>7||y<0||y>7) return;
rgbMatrixData[x*8+y] = c;
rgbMatrix.displayFrames(rgbMatrixData,0,1,1);}

void setup(){
pinMode(2, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
Wire.begin();
pinMode(2, INPUT);
pinMode(3, OUTPUT);
  led4.setColorRGB(0,0,0,0);
  digitalWrite(5,LOW);
  digitalWrite(6,LOW);
  digitalWrite(7,LOW);
  Serial.begin(9600);
  _E5_AD_A3_E8_8A_82 = 1;
  char *rgbMatrixStr="hello";
  rgbMatrix.displayString(rgbMatrixStr,5000,0,1);
  delay(5000);

groveLedBar.begin();
servo_9.attach(9);

}


void loop(){

  delay(3000);
  digitalWrite(7,HIGH);
  while(digitalRead(2) == false){
  }
  if ((_E5_AD_A3_E8_8A_82 == 1)) {
    led4.setColorRGB(0,0xff,0x6e,0x00);
    setRgbMatrixShapeData(0xff,0xff,0xff,0xff,0x20,0xff,0xff,0xff,0xff,0xff,0x20,0x20,0x20,0x20,0xff,0xff,0xff,0x20,0x20,0x00,0x00,0x20,0x20,0xff,0x20,0x20,0x00,0x00,0x00,0x00,0x20,0xff,0xff,0x20,0x00,0x00,0x00,0x00,0x20,0x20,0xff,0x20,0x20,0x00,0x00,0x20,0x20,0xff,0xff,0xff,0x20,0x20,0x20,0x20,0xff,0xff,0xff,0xff,0xff,0x20,0xff,0xff,0xff,0xff);
    rgbMatrix.displayFrames(rgbMatrixShapeData,0,1,1);
    digitalWrite(6,HIGH);
    delay(3000);
    digitalWrite(6,LOW);
  }
  if ((_E5_AD_A3_E8_8A_82 == 2)) {
    led4.setColorRGB(0,0x00,0x9d,0xff);
    setRgbMatrixShapeData(0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x90,0x90,0x90,0xff,0xff,0xff,0xff,0x90,0x90,0x90,0x90,0x90,0xff,0xff,0x90,0x70,0x90,0x90,0x90,0x90,0x70,0xff,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x90,0xff,0xff,0x90,0xff,0xff,0xff,0xff,0xff,0x70,0xff,0xff,0x70,0xff);
    rgbMatrix.displayFrames(rgbMatrixShapeData,0,1,1);
    digitalWrite(3,HIGH);
    delay(3000);
    digitalWrite(3,LOW);
  }
  if ((_E5_AD_A3_E8_8A_82 == 3)) {
    setRgbMatrixShapeData(0xff,0xff,0x20,0x20,0x20,0x20,0xff,0xff,0xff,0x20,0x20,0x20,0x20,0x20,0x20,0xff,0x20,0x20,0xfe,0x20,0x20,0xfe,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xfe,0x20,0x20,0x20,0x20,0xfe,0x20,0xff,0x20,0xfe,0xfe,0xfe,0xfe,0x20,0xff,0xff,0xff,0x20,0x20,0x20,0x20,0xff,0xff);
    rgbMatrix.displayFrames(rgbMatrixShapeData,0,1,1);
    for(i=50;i<=255;i+=5)
    {
      analogWrite(5, i);
      delay(100);
      if ((i == 255)) {
        for(j=255;j<=50;j+=5)
        {
          analogWrite(5, j);
          delay(100);

        }
      }

    }
    _E5_AD_A3_E8_8A_82 = 0;
  }
  _E5_AD_A3_E8_8A_82 = _E5_AD_A3_E8_8A_82 + 1;

}

Credits

Ni Jiaqi, Zhi Jiayi, Feng Jixuan, Xu Jingwen

Posted by Naya Lee

Comments