AMS и магический кристалл

image

( ?) . — . — Arduino Mega Server nooLite SD111-180.

( ), , .

, …


, - , . (, , ) nooLite . Arduino Mega Server nooLite. , .


nooLite SD111-180, « », - . , nooLite, — — : «» R, G, B.

image


nooLite, Arduino Mega Server. , nooLite , , . .

«» , nooLite MT1132.

void nooSendCommandLed(byte channel, byte command, byte r, byte g, byte b, byte format) {
  byte buf[12];
  
  ledLastState[0] = r;
  ledLastState[1] = g;
  ledLastState[2] = b;

  for (byte i = 0; i < 12; i++) {
    buf[i] = 0;
  }

  buf[0] = 85;
  buf[1] = B01010000;
  buf[2] = command;
  buf[3] = format;
  buf[5] = channel;
  buf[6] = r;
  buf[7] = g;
  buf[8] = b;
  
  int checkSum = 0;
  for (byte i = 0; i < 10; i++) {
    checkSum += buf[i];
  }

  buf[10] = lowByte(checkSum);
  buf[11] = 170;

  for (byte i = 0; i < (12); i++) {
    Serial1.write(buf[i]);
  }
}

nooSendCommand, . . 6, 7, 8 , R, G, B.

byte ledLastState[] = {127, 127, 127};

. , , . , , , .



byte const NOO_CHANNEL_3 = 2;

32 , nooLite MT1132.

, nooLite SD111-180, , , . -, .



void nooLed (byte ch, byte r, byte g, byte b) {
  nooSendCommandLed(ch,  6, r, g, b, 3);
}

. 16 . - ( ).

void nooRed    (byte ch, byte v) {nooSendCommandLed(ch,  6, v, 0, 0, 3);}
void nooGreen  (byte ch, byte v) {nooSendCommandLed(ch,  6, 0, v, 0, 3);}
void nooBlue   (byte ch, byte v) {nooSendCommandLed(ch,  6, 0, 0, v, 3);}
void nooYellow (byte ch, byte v) {nooSendCommandLed(ch,  6, v, v, 0, 3);}
void nooMagenta(byte ch, byte v) {nooSendCommandLed(ch,  6, v, 0, v, 3);}
void nooCyan   (byte ch, byte v) {nooSendCommandLed(ch,  6, 0, v, v, 3);}

0 255. «» . , .

void nooBlack  (byte ch)         {nooSendCommandLed(ch,  6, 0, 0, 0, 3);}
void nooWhite  (byte ch)         {nooSendCommandLed(ch,  6, 255, 255, 255, 3);}
void nooGray   (byte ch, byte v) {nooSendCommandLed(ch,  6, v, v, v, 3);}

, nooLite Arduino Mega Server, ( nooLite ). ( , ).

void nooSetLedLastState(byte ch) {
  nooSendCommandLed(ch,  6, ledLastState[0], ledLastState[1], ledLastState[2], 3);
}

nooLite.

/*
  Modul nooLite for Due
  part of Arduino Mega Server project
*/

#ifdef NOO_FEATURE

byte const PIN_TX = 18; // TX PIN (to RX noolite)
byte const PIN_RX = 19; // RX PIN (to TX noolite)

byte const NOO_CHANNEL_1 = 0; // channel (address) 0...31 (MT1132)
byte const NOO_CHANNEL_2 = 1;
byte const NOO_CHANNEL_3 = 2;
byte const NOO_CHANNEL_4 = 3;
byte const NOO_CHANNEL_5 = 4;

void nooInit() {
  Serial1.begin(9600);
  modulNoo = MODUL_ENABLE;
  started("nooLite");
}

void nooWork() {

}

void nooSendCommand(byte channel, byte command, byte data, byte format) {
  byte buf[12];

  for (byte i = 0; i < 12; i++) {
    buf[i] = 0;
  }

  buf[0] = 85;
  buf[1] = B01010000;
  buf[2] = command;
  buf[3] = format;
  buf[5] = channel;
  buf[6] = data;

  int checkSum = 0;
  for (byte i = 0; i < 10; i++) {
    checkSum += buf[i];
  }

  buf[10] = lowByte(checkSum);
  buf[11] = 170;

  for (byte i = 0; i < (12); i++) {
    Serial1.write(buf[i]);
  }
  /*
  Serial.println(">");
  for (byte i = 0; i < (12); i++) {
    Serial.print(buf[i]);
  }
  Serial.println();
  */
}

byte ledLastState[] = {127, 127, 127}; 

void nooSendCommandLed(byte channel, byte command, byte r, byte g, byte b, byte format) {
  byte buf[12];
  
  ledLastState[0] = r;
  ledLastState[1] = g;
  ledLastState[2] = b;

  for (byte i = 0; i < 12; i++) {
    buf[i] = 0;
  }

  buf[0] = 85;
  buf[1] = B01010000;
  buf[2] = command;
  buf[3] = format;
  buf[5] = channel;
  buf[6] = r;
  buf[7] = g;
  buf[8] = b;
  
  int checkSum = 0;
  for (byte i = 0; i < 10; i++) {
    checkSum += buf[i];
  }

  buf[10] = lowByte(checkSum);
  buf[11] = 170;

  for (byte i = 0; i < (12); i++) {
    Serial1.write(buf[i]);
  }
}

//                                     command data format
void nooBind   (byte ch) {nooSendCommand(ch, 15, 0, 0);}
void nooUnbind (byte ch) {nooSendCommand(ch,  9, 0, 0);}

void nooOn     (byte ch) {nooSendCommand(ch,  2, 0, 0);}
void nooOff    (byte ch) {nooSendCommand(ch,  0, 0, 0);}
void nooTrigger(byte ch) {nooSendCommand(ch,  4, 0, 0);}
void nooCancel (byte ch) {nooSendCommand(ch, 10, 0, 0);}

void nooUp     (byte ch) {nooSendCommand(ch,  3, 0, 0);}
void nooDown   (byte ch) {nooSendCommand(ch,  1, 0, 0);}
void nooRevers (byte ch) {nooSendCommand(ch,  5, 0, 0);}

void nooValue  (byte ch, byte v) {nooSendCommand(ch,  6, v, 1);}

void nooLed    (byte ch, byte r, byte g, byte b) {nooSendCommandLed(ch,  6, r, g, b, 3);}
void nooBlack  (byte ch)         {nooSendCommandLed(ch,  6, 0, 0, 0, 3);}
void nooWhite  (byte ch)         {nooSendCommandLed(ch,  6, 255, 255, 255, 3);}
void nooGray   (byte ch, byte v) {nooSendCommandLed(ch,  6, v, v, v, 3);}
void nooRed    (byte ch, byte v) {nooSendCommandLed(ch,  6, v, 0, 0, 3);}
void nooGreen  (byte ch, byte v) {nooSendCommandLed(ch,  6, 0, v, 0, 3);}
void nooBlue   (byte ch, byte v) {nooSendCommandLed(ch,  6, 0, 0, v, 3);}
void nooYellow (byte ch, byte v) {nooSendCommandLed(ch,  6, v, v, 0, 3);}
void nooMagenta(byte ch, byte v) {nooSendCommandLed(ch,  6, v, 0, v, 3);}
void nooCyan   (byte ch, byte v) {nooSendCommandLed(ch,  6, 0, v, v, 3);}

void nooSetLedLastState(byte ch) {nooSendCommandLed(ch,  6, ledLastState[0], ledLastState[1], ledLastState[2], 3);}

#endif // NOO_FEATURE


, AMS.


nooLite Arduino Mega Server. ( «»/«» ).

image

, AMS nooLite. .

. , , . . . .


, Arduino Mega Server nooLite. , , . — - . , , (, , . .) , .

.


« ». ? — , - , (, , . .) . . , , «» . «», . . (, !), , .

image

, , . , , « » , , « » , - , , . , , , , , .

image

« » . , : , , « » . . «» , .

«» . , ( ) . . . , , , «» .

image

, , , , , . . , 2- , , , -.

image


, , — Arduino Mega Server, nooLite SD111-180 . , , , 0.15 AMS, nooLite .

:

nooLite ( 1). Arduino
nooLite ( 2). Arduino Mega Server
nooLite ( 3).

Arduino Mega Server Youtube,

Arduino Mega Server promo

Source: https://habr.com/ru/post/hi390025/


All Articles