Start an example of using the BLE by copying the example 06-AppTutorial/01-BasicGain_wApp

error: pathspec 'examples/07-Bluetooth/01-BasicGain_wApp_BLE/01-BasicGain_wApp_BLE.ino' did not match any file(s) known to git

--- examples/07-Bluetooth/01-BasicGain_wApp_BLE/01-BasicGain_wApp_BLE.ino
+++ examples/07-Bluetooth/01-BasicGain_wApp_BLE/01-BasicGain_wApp_BLE.ino
@@ -0,0 +1,145 @@
+/*
+*   BasicGain_wApp
+*
+*   Created: Chip Audette, June 2020
+*   Purpose: Process audio using Tympan by applying gain.
+*      Also, illustrate how to change Tympan setting via the TympanRemote App.
+*
+*   Blue potentiometer adjusts the digital gain applied to the audio signal.
+*
+*   Uses default sample rate of 44100 Hz with Block Size of 128
+*
+*   TympanRemote App: https://play.google.com/store/apps/details?id=com.creare.tympanRemote&hl=en_US
+*
+*   MIT License.  use at your own risk.
+*/
+
+//here are the libraries that we need
+#include <Tympan_Library.h>  //include the Tympan Library
+
+//create audio library objects for handling the audio
+Tympan                    myTympan(TympanRev::D);  //do TympanRev::D or TympanRev::C
+AudioInputI2S_F32         i2s_in;        //Digital audio *from* the Tympan AIC.
+AudioEffectGain_F32       gain1, gain2;  //Applies digital gain to audio data.
+AudioOutputI2S_F32        i2s_out;       //Digital audio *to* the Tympan AIC.  Always list last to minimize latency
+
+//Make all of the audio connections
+AudioConnection_F32       patchCord1(i2s_in, 0, gain1, 0);    //connect the Left input
+AudioConnection_F32       patchCord2(i2s_in, 1, gain2, 0);    //connect the Right input
+AudioConnection_F32       patchCord11(gain1, 0, i2s_out, 0);  //connect the Left gain to the Left output
+AudioConnection_F32       patchCord12(gain2, 0, i2s_out, 1);  //connect the Right gain to the Right output
+
+//define class for handling the GUI on the app
+#include "TympanRemoteFormatter.h"
+TympanRemoteFormatter myGUI;  //Creates the GUI-writing class for interacting with TympanRemote App
+
+
+// define the setup() function, the function that is called once when the device is booting
+const float input_gain_dB = 10.0f; //gain on the microphone
+float digital_gain_dB = 0.0;      //this will be set by the app
+void setup() {
+
+  //begin the serial comms (for debugging)
+  myTympan.beginBothSerial();
+  delay(3000);
+  myTympan.println("BasicGain_wApp: starting setup()...");
+
+  //allocate the dynamic memory for audio processing blocks
+  AudioMemory_F32(10);
+
+  //Enable the Tympan to start the audio flowing!
+  myTympan.enable(); // activate the Tympan's audio module
+
+  //Choose the desired input
+  myTympan.inputSelect(TYMPAN_INPUT_ON_BOARD_MIC);     // use the on board microphones
+  //myTympan.inputSelect(TYMPAN_INPUT_JACK_AS_MIC);    // use the microphone jack - defaults to mic bias 2.5V
+  //myTympan.inputSelect(TYMPAN_INPUT_JACK_AS_LINEIN); // use the microphone jack - defaults to mic bias OFF
+
+  //Set the desired volume levels
+  myTympan.volume_dB(0);                   // headphone amplifier.  -63.6 to +24 dB in 0.5dB steps.
+  myTympan.setInputGain_dB(input_gain_dB); // set input volume, 0-47.5dB in 0.5dB setps
+
+  //Create the GUI description (but not yet transmitted to the App...that's after it connects)
+  createTympanRemoteLayout();
+
+  Serial.println("Setup complete.");
+} //end setup()
+
+
+// define the loop() function, the function that is repeated over and over for the life of the device
+void loop() {
+
+  //look for in-coming serial messages (via USB or via Bluetooth)
+  if (Serial.available()) respondToByte((char)Serial.read());   //USB Serial
+  if (Serial1.available()) respondToByte((char)Serial1.read()); //BT Serial
+
+} //end loop();
+
+
+// ///////////////// Servicing routines
+
+//respond to serial commands
+void respondToByte(char c) {
+  myTympan.print("Received character "); myTympan.println(c);
+
+  switch (c) {
+    case 'J': case 'j':
+      printTympanRemoteLayout();
+      break;
+    case 'k':
+      changeGain(3.0);
+      printGainLevels();
+      break;
+    case 'K':
+      changeGain(-3.0);
+      printGainLevels();
+      break;
+  }
+}
+
+// Print the layout for the Tympan Remote app, in a JSON-ish string
+// (single quotes are used here, whereas JSON spec requires double quotes.  The app converts ' to " before parsing the JSON string).
+// Please don't put commas or colons in your ID strings!
+void printTympanRemoteLayout(void) {
+  myTympan.println(myGUI.asString());
+}
+
+//define the GUI for the App
+void createTympanRemoteLayout(void) {
+
+  // Create some temporary variables
+  TR_Page *page_h;  //dummy handle for a page
+  TR_Card *card_h;  //dummy handle for a card
+
+  //Add first page to GUI
+  page_h = myGUI.addPage("MyFirstPage");
+      card_h = page_h->addCard("Change Loudness");
+        #if 0
+          card_h->addButton("-","K");   //assumes default ID and default width.
+          card_h->addButton("+","k");   //assumes default ID and default width
+        #else
+          card_h->addButton("-","K","minusButton",6);  //displayed string, command, button ID, button width (out of 12)
+          card_h->addButton("+","k","plusButton",6);   //displayed string, command, button ID, button width (out of 12)
+        #endif
+
+  //add some pre-defined pages to the GUI
+  myGUI.addPredefinedPage("serialMonitor");
+  myGUI.addPredefinedPage("plot");
+}
+
+
+//change the gain from the App
+void changeGain(float change_in_gain_dB) {
+  digital_gain_dB = digital_gain_dB + change_in_gain_dB;
+  gain1.setGain_dB(digital_gain_dB);  //set the gain of the Left-channel gain processor
+  gain2.setGain_dB(digital_gain_dB);  //set the gain of the Right-channel gain processor
+}
+
+
+//Print gain levels
+void printGainLevels(void) {
+  myTympan.print("Analog Input Gain (dB) = ");
+  myTympan.println(input_gain_dB); //print text to Serial port for debugging
+  myTympan.print("Digital Gain (dB) = ");
+  myTympan.println(digital_gain_dB); //print text to Serial port for debugging
+}


TFTPクライアントのサンプルプログラム

TFTPクライアントのサンプルプログラム

error: pathspec '2_example/example58_tftp/example58_tftp.ino' did not match any file(s) known to git

--- 2_example/example58_tftp/example58_tftp.ino
+++ 2_example/example58_tftp/example58_tftp.ino
@@ -0,0 +1,161 @@
+/*******************************************************************************
+Example 58(=32+26): センサデバイス用 TFTPクライアント 設定
+
+本ESPモジュールは、TFTPサーバ上の設定ファイルをダウンロードし、モジュール内の
+設定を変更します。
+
+※本サンプル作成の段階では、(暫定的に)下記ライブラリを使用しました。
+    https://github.com/copercini/arduino-esp32-SPIFFS
+※今後、esp-idfや上記ライブラリを基にしたものが公式サポートされると思います。
+
+Raspberry PiへのTFTPサーバのインストール方法
+    $ sudo apt-get install tftpd-hpa
+
+    設定ファイル(/etc/default/tftpd-hpa) 例
+    # /etc/default/tftpd-hpa
+    TFTP_USERNAME="tftp"
+    TFTP_DIRECTORY="/srv/tftp"
+    TFTP_ADDRESS="0.0.0.0:69"
+
+TFTPサーバの起動と停止
+    /etc/init.d/tftpd-hpa start
+    /etc/init.d/tftpd-hpa stop
+
+転送用のファイルを保存
+    $ echo "Hello! This is from RasPi" > /srv/tftp/esp8266_tftpc_1.ini
+
+【注意事項】
+・ESPモジュールのTFTPクライアントを起動したままにすると、危険です
+・TFTPサーバ起動したままにすると、Raspberry Piが脅威にさらされます。
+・ウィルスやワームが侵入すると、同じネットワーク上の全ての機器へ感染する恐れが
+　高まります。
+
+                                           Copyright (c) 2016-2017 Wataru KUNINO
+*******************************************************************************/
+#include <WiFi.h>                           // ESP32用WiFiライブラリ
+#include <WiFiUdp.h>                        // UDP通信を行うライブラリ
+#include "esp_deep_sleep.h"                 // ESP32用Deep Sleep ライブラリ
+#define PIN_EN 2                            // GPIO 2(24番ピン)をセンサの電源に
+#define PIN_AIN 34                          // GPIO 34 ADC1_CH6(6番ピン)をADCに
+#define SSID "1234ABCD"                     // 無線LANアクセスポイントのSSID
+#define PASS "password"                     // パスワード
+#define SENDTO "192.168.0.255"              // 送信先のIPアドレス
+#define PORT 1024                           // 送信のポート番号
+#define SLEEP_P 50*1000000                  // スリープ時間 50秒(uint32_t)
+#define DEVICE "tftpc_1,"                   // デバイス名(5文字+"_"+番号+",")
+#define TFTP_PORT_C 69                      // TFTP接続用ポート番号(既定)
+#define TFTP_PORT_T 1234                    // TFTP転送用ポート番号(任意)
+#define TFTP_TIMEOUT 10                     // TFTP待ち受け時間(ms)
+#define TFTP_FILENAME "/srv/tftp/esp8266_tftpc_1.ini" // TFTP受信ファイル名
+char data[512];                             // TFTPデータ用変数
+WiFiUDP tftp;                               // TFTP通信用のインスタンスを定義
+
+void setup(){                               // 起動時に一度だけ実行する関数
+    pinMode(PIN_AIN,INPUT);                 // アナログ入力の設定
+    pinMode(PIN_EN,OUTPUT);                 // センサ用の電源を出力に
+    Serial.begin(115200);                   // 動作確認のためのシリアル出力開始
+    Serial.println("ESP32 eg.26 TFTP");     // 「ESP32 eg.26」をシリアル出力表示
+    WiFi.mode(WIFI_STA);                    // 無線LANをSTAモードに設定
+    delay(10);                              // ESP32に必要な待ち時間
+    WiFi.begin(SSID,PASS);                  // 無線LANアクセスポイントへ接続
+    while(WiFi.status() != WL_CONNECTED){   // 接続に成功するまで待つ
+        delay(500);                         // 待ち時間処理
+        digitalWrite(PIN_EN,!digitalRead(PIN_EN));      // LEDの点滅
+        Serial.print(".");
+    }
+    Serial.println(WiFi.localIP());         // 本機のIPアドレスをシリアル出力
+    tftpStart();                            // TFTPの開始
+    while( tftpGet() );                     // データ受信
+}
+
+void tftpStart(){
+    tftp.begin(TFTP_PORT_T);                // TFTP(受信)の開始
+    tftp.beginPacket(SENDTO, TFTP_PORT_C);  // TFTP送信先を設定
+    tftp.write(0x0); tftp.write(0x01);      // Read Requestコマンド(RRQ)
+    tftp.print(TFTP_FILENAME);              // ファイル名
+    tftp.write(0x0);                        // ファイル名の終端
+    tftp.print("netascii");                 // ASCIIモード
+    tftp.write(0x0);                        // モード名の終端
+    tftp.endPacket();                       // TFTP送信の終了(実際に送信する)
+    Serial.println("Send TFTP RRQ");        // 送信完了をシリアル端末へ表示
+}
+
+int tftpGet(){
+    int len=0,time=0;
+    IPAddress ip;
+
+    while(len<5){                           // 未受信の間、繰り返し実行
+        delay(1);                           // 1msの待ち時間
+        len = tftp.parsePacket();           // 受信パケット長を変数lenに代入
+        time++;                             // 時間のカウント
+        if(time>TFTP_TIMEOUT) return 0;     // タイムアウト(応答値は0)
+    }
+    ip=tftp.remoteIP();                     // サーバのIPアドレスを取得
+    tftp.read(data, 511);                   // 最大511バイトまで受信する
+    Serial.print("Recieved (");
+    for(int i=0;i<4;i++) Serial.print(data[i],DEC); // コマンド、ブロック番号
+    Serial.print(") ");
+    Serial.print(len - 4);                  // 受信データ長を表示
+    Serial.print(" Bytes from ");
+    Serial.println(ip);                     // サーバのIPアドレスを表示
+    if(len > 511){
+        Serial.println("FILE SIZE ERROR");  // 複数ブロックの転送には対応しない
+        return -1;                          // ERROR(応答値は-1)
+    }
+    if(data[0]==0x0 && data[1]==0x3){       // TFTP転送データの時
+        Serial.print(&data[4]);             // TFTP受信データを表示する
+        Serial.println("[EOF]");
+        tftp.beginPacket(ip, TFTP_PORT_T);  // TFTP ACK送信先を設定
+        tftp.write(0x0); tftp.write(0x04);  // 受信成功コマンド(ACK)を送信
+        tftp.write(data[2]);                // ブロック番号の上位1バイトを送信
+        tftp.write(data[3]);                // ブロック番号の下位1バイトを送信
+        tftp.endPacket();                   // TFTP送信の終了(実際に送信する)
+        return len;
+    }
+    return -1;                              // ERROR(応答値は-1)
+}
+
+void loop() {
+    WiFiUDP udp;                            // UDP通信用のインスタンスを定義
+    int adc;                                // 整数型変数adcを定義
+
+    digitalWrite(PIN_EN,HIGH);              // センサ用の電源をONに
+    delay(5);                               // 起動待ち時間
+    adc=(int)mvAnalogIn(PIN_AIN);           // AD変換器から値を取得
+    digitalWrite(PIN_EN,LOW);               // センサ用の電源をOFFに
+    udp.beginPacket(SENDTO, PORT);          // UDP送信先を設定
+    udp.print(DEVICE);                      // デバイス名を送信
+    udp.println(adc);                       // 変数adcの値を送信
+    Serial.println(adc);                    // シリアル出力表示
+    udp.endPacket();                        // UDP送信の終了(実際に送信する)
+    delay(200);                             // 送信待ち時間
+    esp_deep_sleep(SLEEP_P);                // Deep Sleepモードへ移行
+}
+
+float mvAnalogIn(uint8_t PIN){
+    int in0,in3;
+    float ad0,ad3;
+
+    analogSetPinAttenuation(PIN,ADC_11db);
+    in3=analogRead(PIN);
+
+    if( in3 > 2599 ){
+        ad3 = -1.457583e-7 * (float)in3 * (float)in3
+            + 1.510116e-3 * (float)in3
+            - 0.573300;
+    }else{
+        ad3 = 8.378998e-4 * (float)in3 + 1.891456e-1;
+    }
+    if( in3 < 200 ){
+        analogSetPinAttenuation(PIN,ADC_0db);
+        in0=analogRead(PIN);
+        ad0 = 2.442116e-4 * (float)in0 + 1.075584e-1;
+        if( in3 >= 100 ){
+            ad3 = ad3 * ((float)in3 - 100.) / 100.
+                + ad0 * (200. - (float)in3) / 100.;
+        }else{
+            ad3 = ad0;
+        }
+    }
+    return ad3 * 1000.;
+}


Added state-machine

Added state-machine

error: pathspec 'examples/04_SimpleChronometerStateMachine/04_SimpleChronometerStateMachine.ino' did not match any file(s) known to git

--- examples/04_SimpleChronometerStateMachine/04_SimpleChronometerStateMachine.ino
+++ examples/04_SimpleChronometerStateMachine/04_SimpleChronometerStateMachine.ino
@@ -0,0 +1,121 @@
+// Include to use LCD display
+//#include <LiquidCrystal.h>
+// Include to show
+#include <stdio.h>
+
+//const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
+//LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
+
+const int btn1 = 9;
+const int btn2 = 10;
+
+void setup() {
+  //lcd.begin(16, 2);
+  Serial.begin(9600);
+  //lcd.print(stringTime);
+  Serial.println("00:00:00");
+
+  // Initialize Button Input
+  pinMode(btn1, INPUT_PULLUP);
+  pinMode(btn2, INPUT_PULLUP);
+}
+
+long lastTimestamp = 0;
+long elapsedSeconds = 0;
+long lastEvtBtn1 = 0;
+long lastEvtBtn2 = 0;
+bool clockEnabled = false;
+
+enum valid_states {
+  WAIT = 0,
+  DISPLAY_TIME = 1,
+  START_STOP_CLOCK = 2,
+  RESET = 3
+};
+
+int machine_state = 0;
+
+bool tick_flag = false;
+bool btn1_flag = false;
+bool btn2_flag = false;
+
+void displayElapsedTime(long elapsedSeconds) {
+  char stringTime[9];
+
+  int hours = elapsedSeconds/(60*60);
+  int minutes = (elapsedSeconds-(hours*60*60))/60;
+  int seconds = elapsedSeconds-(hours*60*60)-(minutes*60);
+
+  // Format time to display
+  sprintf(stringTime, "%02d:%02d:%02d", hours, minutes, seconds);
+
+  // Display on LCD
+  //lcd.clear();
+  //lcd.setCursor(0,0);
+  //lcd.print(stringTime);
+  Serial.println(stringTime);
+}
+
+void loop() {
+  // Este evento se llama cada segundo
+  if((millis()-lastTimestamp)>1000) {
+    tick_flag = true;
+    lastTimestamp = millis();
+  }
+
+  // Eventos generados cada vez que se presiona un botón
+  //btn1_flag |= !digitalRead(btn1);
+  //btn2_flag |= !digitalRead(btn2);
+
+  // Con eliminador de rebote:
+  if((millis()-lastEvtBtn1)>100 && !digitalRead(btn1)) {
+    btn1_flag = 1;
+    lastEvtBtn1 = millis();
+  }
+  if((millis()-lastEvtBtn2)>100 && !digitalRead(btn2)) {
+    btn2_flag = 1;
+    lastEvtBtn2 = millis();
+  }
+
+  switch(machine_state) {
+    case WAIT:
+      if(btn1_flag) {
+        btn1_flag = false;
+        machine_state = START_STOP_CLOCK;
+        break;
+      }
+      if(btn2_flag) {
+        btn2_flag = false;
+        machine_state = RESET;
+        break;
+      }
+      if(tick_flag) {
+        tick_flag = false;
+        machine_state = DISPLAY_TIME;
+        break;
+      }
+      break;
+
+    case DISPLAY_TIME:
+      // Display on screen or serial
+      displayElapsedTime(elapsedSeconds);
+
+      // Increase clock only if clockEnabled
+      if(clockEnabled)
+        elapsedSeconds += 1;
+
+      // automatically change state for next run
+      machine_state = WAIT;
+      break;
+
+    case START_STOP_CLOCK:
+      clockEnabled = !clockEnabled;
+      machine_state = WAIT;
+      break;
+
+    case RESET:
+      elapsedSeconds = 0;
+      machine_state = WAIT;
+      break;
+  }
+}


added reset sketch for UniqueID example

added reset sketch for UniqueID example

error: pathspec 'deploy-dist/rootfolder/examples/UniqueID/sketch/resetUniqueID/resetUniqueID.ino' did not match any file(s) known to git

--- deploy-dist/rootfolder/examples/UniqueID/sketch/resetUniqueID/resetUniqueID.ino
+++ deploy-dist/rootfolder/examples/UniqueID/sketch/resetUniqueID/resetUniqueID.ino
@@ -0,0 +1,55 @@
+/*
+Copyright 2013 project Ardulink http://www.ardulink.org/
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+This sketch is an example to understand how Arduino can recognize ALProtocol.
+However, it can easily be reused for their own purposes or as a base for a library.
+Read carefully the comments. When you find "this is general code you can reuse"
+then it means that it is generic code that you can use to manage the ALProtocol.
+When you find "this is needed just as example for this sketch" then it means that
+you code useful for a specific purpose. In this case you have to modify it to suit
+your needs.
+*/
+#include <EEPROM.h>
+
+
+/*
+Unique ID is suggested by connected PC. Then it is stored and used for ever.
+Unique ID is stored in EEPROM at a given address. A magic number (2 bytes) "LZ"
+is used to understand if it is already stored or not.
+Actually Unique ID is a UUID in the string format (36 bytes instead of just 16, yes it could be better).
+https://en.wikipedia.org/wiki/Universally_unique_identifier
+So the final length to store the unique id is 38 bytes.
+*/
+#define UNIQUE_ID_EEPROM_ADDRESS 0
+#define UNIQUE_ID_LENGTH 38
+#define UNIQUE_ID_MAGIC_NUMBER_HIGH 76
+#define UNIQUE_ID_MAGIC_NUMBER_LOW 90
+
+void resetUniqueID() {
+
+  char buffer[UNIQUE_ID_LENGTH + 1];
+  for(int i = 0; i < UNIQUE_ID_LENGTH + 1; i++) {
+    buffer[i] = 0;
+  }
+  EEPROM.put( UNIQUE_ID_EEPROM_ADDRESS, buffer );
+}
+
+void setup(){
+  resetUniqueID();
+}
+
+void loop(){
+}
+


Updated Sensor Code

Updated Sensor Code

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/sassystacks/DASS.git/'


added arduino code

added arduino code

error: pathspec 'apps/Pong/arduino/Buzzer_post_multiple_channels/Buzzer_post_multiple_channels.ino' did not match any file(s) known to git

--- apps/Pong/arduino/Buzzer_post_multiple_channels/Buzzer_post_multiple_channels.ino
+++ apps/Pong/arduino/Buzzer_post_multiple_channels/Buzzer_post_multiple_channels.ino
@@ -0,0 +1,233 @@
+
+
+#include "FastLED.h"
+#include <Keyboard.h>
+
+#define MAX_HELLIGKEIT_STRIPES 180
+#define FADE_NEXT_ON_AT 30
+#define MIN_HELLIGKEIT_PULSE 100
+
+#define MAX_HELLIGKEIT_CIRCLE 150
+
+#define CIRCLE_SPEED 4
+#define STRIPE_SPEED 10
+
+
+
+#define NUM_LEDS_circle 24
+
+#define NUM_LEDS_stripe 60
+#define START_LED_STRIPE 12
+
+#define DATA_PIN_circle 4
+
+#define NUM_STRIPES 4
+#define DATA_PIN_stripe1 5
+#define DATA_PIN_stripe2 6
+#define DATA_PIN_stripe3 9
+#define DATA_PIN_stripe4 8
+
+#define sensor_input 3
+#define button_input 12
+
+
+
+CRGB leds_circle[NUM_LEDS_circle];
+CRGB leds_stripe[NUM_STRIPES][NUM_LEDS_stripe];
+
+void setup() {
+  // declare the ledPin as an OUTPUT:
+  pinMode(sensor_input, INPUT);
+  pinMode(button_input, INPUT);
+  digitalWrite(button_input, HIGH);
+  Keyboard.begin();
+  //Serial.begin(9600);
+
+  FastLED.addLeds<WS2812, DATA_PIN_circle, GRB>(leds_circle, NUM_LEDS_circle);
+  FastLED.addLeds<WS2812, DATA_PIN_stripe1, GRB>(leds_stripe[0], NUM_LEDS_stripe);
+  FastLED.addLeds<WS2812, DATA_PIN_stripe2, GRB>(leds_stripe[1], NUM_LEDS_stripe);
+  FastLED.addLeds<WS2812, DATA_PIN_stripe3, GRB>(leds_stripe[2], NUM_LEDS_stripe);
+  FastLED.addLeds<WS2812, DATA_PIN_stripe4, GRB>(leds_stripe[3], NUM_LEDS_stripe);
+  clear_display(0);
+  clear_display(1);
+  FastLED.show();
+
+}
+
+void loop() {
+
+  CRGB color_rgb;
+  CHSV hsv_color;
+  int circle_direction[NUM_LEDS_circle];
+  int circle_value[NUM_LEDS_circle];
+  int stripe_direction[NUM_LEDS_stripe];
+  int stripe_value[NUM_LEDS_stripe];
+  int previous_led, touched, ct_fade;
+  // read the value from the sensor:
+
+  hsv_color.h=0;
+  hsv_color.s=0;
+  hsv_color.v=0;
+
+
+
+  // Geldeinwurf Kreis dreht sich
+
+  for (int ct_x = 0; ct_x < NUM_LEDS_circle; ct_x++)
+  {
+    circle_value[ct_x]=0;
+    circle_direction[ct_x]=0;
+  }
+
+  circle_direction[0]=1;
+  while(digitalRead(sensor_input)) {
+
+    for (int ct_x = 0; ct_x < NUM_LEDS_circle; ct_x++)
+    {
+      if (circle_direction[ct_x]==1) {
+        circle_value[ct_x]=circle_value[ct_x]+CIRCLE_SPEED;
+      }
+      if (circle_direction[ct_x]==2) {
+        circle_value[ct_x]=circle_value[ct_x]-CIRCLE_SPEED;
+      }
+
+      if (circle_value[ct_x]>MAX_HELLIGKEIT_CIRCLE) {
+        circle_direction[ct_x]=2;
+      }
+
+      if (circle_value[ct_x]==0) {
+        circle_direction[ct_x]=0;
+      }
+
+      if ((circle_value[ct_x]>30)&&(circle_direction[ct_x]==1)) {
+        if (ct_x==0) {
+          previous_led=NUM_LEDS_circle-1;
+        }
+        else {
+          previous_led=ct_x-1;
+        }
+        circle_direction[previous_led]=1;
+      }
+
+
+      hsv_color.v=circle_value[ct_x];
+      hsv2rgb_rainbow(hsv_color,leds_circle[ct_x]);
+    }
+    FastLED.show();
+  }
+
+  clear_display(0);
+  FastLED.show();
+
+
+
+  // Lade Säule auf
+
+  for (int ct_x = START_LED_STRIPE; ct_x < NUM_LEDS_stripe; ct_x++)
+  {
+    stripe_value[ct_x]=0;
+    stripe_direction[ct_x]=0;
+  }
+
+  stripe_direction[START_LED_STRIPE]=1;
+  while(stripe_value[NUM_LEDS_stripe-1]<MAX_HELLIGKEIT_STRIPES) {
+
+    for (int ct_x = START_LED_STRIPE; ct_x < NUM_LEDS_stripe; ct_x++)
+    {
+      if (stripe_direction[ct_x]==1) {
+        stripe_value[ct_x]=stripe_value[ct_x]+STRIPE_SPEED;
+      }
+
+      if (stripe_value[ct_x]>MAX_HELLIGKEIT_STRIPES) {
+        stripe_direction[ct_x]=0;
+      }
+
+      if ((stripe_value[ct_x]>FADE_NEXT_ON_AT)&&(stripe_direction[ct_x]==1)) {
+        if (ct_x<NUM_LEDS_stripe-1) {
+          previous_led=ct_x+1;
+        }
+        stripe_direction[previous_led]=1;
+      }
+
+
+      hsv_color.v=stripe_value[ct_x];
+      hsv2rgb_rainbow(hsv_color,color_rgb);
+      for (int ct_stripe = 0; ct_stripe<NUM_STRIPES;ct_stripe++){
+        leds_stripe[ct_stripe][ct_x]=color_rgb;
+      }
+    }
+    FastLED.show();
+
+  }
+
+  // Säule ist bereit und pulsiert
+  touched=0;
+  while(!touched) {
+    ct_fade=MAX_HELLIGKEIT_STRIPES;
+    while ((!touched)&&(ct_fade>MIN_HELLIGKEIT_PULSE)) {
+      hsv_color.v=ct_fade;
+      for (int ct_led = START_LED_STRIPE; ct_led < NUM_LEDS_stripe; ct_led++)
+      {
+        for (int ct_stripe = 0; ct_stripe<NUM_STRIPES;ct_stripe++){
+          hsv2rgb_rainbow(hsv_color,leds_stripe[ct_stripe][ct_led]);
+        }
+        if (!digitalRead(button_input)) {
+          touched=1;
+        }
+      }
+      FastLED.show();
+      ct_fade--;
+    }
+    while ((!touched)&&(ct_fade<MAX_HELLIGKEIT_STRIPES)) {
+      hsv_color.v=ct_fade;
+      for (int ct_led = START_LED_STRIPE; ct_led < NUM_LEDS_stripe; ct_led++)
+      {
+        for (int ct_stripe = 0; ct_stripe<NUM_STRIPES;ct_stripe++){
+          hsv2rgb_rainbow(hsv_color,leds_stripe[ct_stripe][ct_led]);
+        }
+        if (!digitalRead(button_input)) {
+          touched=1;
+        }
+      }
+      FastLED.show();
+      ct_fade++;
+    }
+  }
+  Keyboard.print('p');
+
+  for (int ct_x = MAX_HELLIGKEIT_STRIPES; ct_x >= 0; ct_x--)
+  {
+    hsv_color.v=ct_x;
+    for (int ct_led = START_LED_STRIPE; ct_led < NUM_LEDS_stripe; ct_led++)
+    {
+      for (int ct_stripe = 0; ct_stripe<NUM_STRIPES;ct_stripe++){
+        hsv2rgb_rainbow(hsv_color,leds_stripe[ct_stripe][ct_led]);
+      }
+    }
+  FastLED.show();
+  }
+
+}
+
+
+void clear_display(int channel)
+{
+  int ct_led;
+
+  if (channel==0) {
+    for (int ct_x = 0; ct_x < NUM_LEDS_circle; ct_x++)
+    {
+      leds_circle[ct_x] = CRGB::Black;
+    }
+  }
+  else {
+    for (int ct_x = 0; ct_x < NUM_LEDS_stripe; ct_x++)
+    {
+      for (int ct_stripe = 0; ct_stripe<NUM_STRIPES;ct_stripe++){
+        leds_stripe[ct_stripe][ct_x] = CRGB::Black;
+      }
+    }
+  }
+
+}
+


RF receiver to serial out

RF receiver to serial out

error: pathspec 'receiver_datalog/receiver_datalog.ino' did not match any file(s) known to git

--- receiver_datalog/receiver_datalog.ino
+++ receiver_datalog/receiver_datalog.ino
@@ -0,0 +1,61 @@
+/**
+ * Listen to the RF transmitter and print it to the serial monitor.
+ */
+#include <VirtualWire.h>
+
+
+// Pin 11 is the default receiver pin.
+// @see http://www.airspayce.com/mikem/arduino/VirtualWire_8h.html#ae62b601260ae59e7e83c1e63ae0c064b
+
+int received_reset_interval = 60 * 60 * 1000; // How often to reset the received counter.
+int received_count; // How many transmissions have been received.
+unsigned long received_last_reset;
+
+void setup()
+{
+  pinMode(13, OUTPUT);
+
+  // initialize serial communication
+  Serial.begin(9600);
+  Serial.println("setup");
+
+  received_count = 0;
+  received_last_reset = millis();
+
+  // Initialise the IO and ISR
+  vw_set_ptt_inverted(true); // Required for DR3100
+  vw_setup(2000);      // Bits per sec
+  // vw_set_tx_pin(11);
+  vw_rx_start();       // Start the receiver PLL running
+}
+
+void loop()
+{
+  uint8_t buf[VW_MAX_MESSAGE_LEN];
+  uint8_t buflen = VW_MAX_MESSAGE_LEN;
+
+  unsigned long now = millis();
+  if (now - received_last_reset > received_reset_interval) {
+    received_last_reset = now;
+    received_count = 0;
+  }
+
+  if (vw_get_message(buf, &buflen)) {
+      int i;
+      digitalWrite(13, HIGH); // Flash a light to show received good message
+      // Message with a good checksum received, output it to serial.
+      Serial.print("R: ");
+      for (i = 0; i < buflen; i++) {
+          Serial.print(char(buf[i]));
+      }
+      Serial.println("");
+
+      ++received_count;
+      Serial.print("C: ");
+      Serial.println(received_count);
+
+      digitalWrite(13, LOW);
+  }
+
+}
+


Create base2clock5.ino

Create base2clock5.ino

error: pathspec 'base2clock5.ino' did not match any file(s) known to git

--- base2clock5.ino
+++ base2clock5.ino
@@ -0,0 +1,201 @@
+/***************************
+ *
+ * base 2 clock code for arduino
+ * Copyleft (C) 2015 Daniel K. Spicer
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ ****************************/
+
+// adjust this value to tune the clock. 5000 should be close, lower if clock runs slow, higher if fast.
+#define INTERVAL_TIME 4995
+
+//int's representing led's. 1 = on, 0 = off. Initially they will all be off.
+int p1,p2,p3,p4,p5,p6,p7,p8,p9 = 0;
+int iterations = 0;
+boolean increment, reset_fast, reset_slow, time_set, setting_time = false;
+unsigned long mils, prev_mils = 0;
+
+void setup(){
+  //8 led's as outputs.
+  pinMode(13, OUTPUT);
+  pinMode(12, OUTPUT);
+  pinMode(11, OUTPUT);
+  pinMode(10, OUTPUT);
+  pinMode(9, OUTPUT);
+  pinMode(8, OUTPUT);
+  pinMode(7, OUTPUT);
+  pinMode(6, OUTPUT);
+
+  pinMode(2, INPUT);
+  digitalWrite(2, HIGH);
+
+  attachInterrupt(0, setTimeSlow , FALLING); // pin 2
+
+  prev_mils = millis();
+
+  //time set buttons as inputs.
+  pinMode(4, INPUT);
+  digitalWrite(4, HIGH);
+} // end setup()
+
+void loop(){
+  //reinitialize time setting booleans to false.
+  reset_fast = false;
+  reset_slow = false;
+  setting_time = false;
+
+  //see if the time is being set.
+  if(digitalRead(4) == LOW){
+    reset_fast = true;
+    resetTimeSetFlags();
+  }
+
+  if(!time_set){ // time has never been set so just blink the lights.
+    if(p8 == 1)
+      p8 = p7 = p6 = p5 = p4 = p3 = p2 = p1 = 0;
+    else
+      p8 = p7 = p6 = p5 = p4 = p3 = p2 = p1 = 1;
+    lightLights();
+  } else { //time has been set, so increment as instructed.
+    if(!increment){
+      iterations++;
+      if(iterations == 12){
+        iterations = 0;
+        increment = true;
+      }
+    }
+    if(increment){
+      increment = false;
+      if(setting_time || !setIncrementFlag()){
+        doIncrement();
+      }
+    }
+  } //end time_set is true
+
+  // figure out the loop delay, typically 5 seconds, 1 second if the time has never been set
+  // and we are blinking the lights, 0.1 second if we are coarse setting the time and 1 second
+  // if we are fine setting the time.
+  if(reset_fast){
+    delay(100);
+    iterations = 0;
+  } else if(!time_set) {
+    delay(1000);
+  } else delay(INTERVAL_TIME);
+} // end loop()
+
+void setTimeSlow(){
+  increment = false;
+  time_set = true;
+  iterations = 0;
+  p9 = 0;
+
+  mils = millis();
+  if(mils - prev_mils > 150)
+    doIncrement();
+  prev_mils = mils;
+
+}
+
+void resetTimeSetFlags(){
+  setting_time = true;
+  increment = true;
+  time_set = true;
+  iterations = 0;
+  p9 = 0;
+}
+
+boolean setIncrementFlag(){
+  if(p9 == 0 && (p8 == 0 || p7 == 0 || p6 == 0)){
+    p9 = 1;
+    return true;
+  }
+  return false;
+}
+
+void doIncrement(){
+  p9 = 0;
+
+  if(p8 == 0){
+    p8 = 1;
+  }
+  else if (p7 == 0){
+    p7 = 1;
+    p8 = 0;
+  }
+  else if (p6 == 0){
+    p6 = 1;
+    p8 = p7 = 0;
+  }
+  else if (p5 == 0){
+    p5 = 1;
+    p8 = p7 = p6 = 0;
+  }
+  else if (p4 == 0){
+    p4 = 1;
+    p8 = p7 = p6 = p5 = 0;
+  }
+  else if (p3 == 0){
+    p3 = 1;
+    p8 = p7 = p6 = p5 = p4 = 0;
+  }
+  else if (p2 == 0){
+    p2 = 1;
+    p8 = p7 = p6 = p5 = p4 = p3 = 0;
+  }
+  else if (p1 == 0){
+    p1 = 1;
+    p8 = p7 = p6 = p5 = p4 = p3 = p2 = 0;
+  }
+  else { // all lights were lit, so this increment resets them to all off
+    p8 = p7 = p6 = p5 = p4 = p3 = p2 = p1 = 0;
+  }
+
+  lightLights();
+} // end doIncrement()
+
+void lightLights() {
+  if(p1 == 1)
+    digitalWrite(13, HIGH);
+  else
+    digitalWrite(13, LOW);
+  if(p2 == 1)
+    digitalWrite(12, HIGH);
+  else
+    digitalWrite(12, LOW);
+  if(p3 == 1)
+    digitalWrite(11, HIGH);
+  else
+    digitalWrite(11, LOW);
+  if(p4 == 1)
+    digitalWrite(10, HIGH);
+  else
+    digitalWrite(10, LOW);
+  if(p5 == 1)
+    digitalWrite(9, HIGH);
+  else
+    digitalWrite(9, LOW);
+  if(p6 == 1)
+    digitalWrite(8, HIGH);
+  else
+    digitalWrite(8, LOW);
+  if(p7 == 1)
+    digitalWrite(7, HIGH);
+  else
+    digitalWrite(7, LOW);
+  if(p8 == 1)
+    digitalWrite(6, HIGH);
+  else
+    digitalWrite(6, LOW);
+} // end lightLights()


Combined the ESP8266 with the sketch

Combined the ESP8266 with the sketch

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Omemanti/MantiOT.git/'


add misc sketch for playing with an RTC module

error: pathspec 'code/ds3231/ds3231.ino' did not match any file(s) known to git

--- code/ds3231/ds3231.ino
+++ code/ds3231/ds3231.ino
@@ -0,0 +1,102 @@
+// Date and time functions using a DS3231 RTC connected via I2C and Wire lib
+#include <Wire.h>
+#include "RTClib.h"
+
+
+// Pinout of the RTC modules:
+// from top (chip side) pins on top
+//   1 - Vdd
+//   2 - SDA
+//   3 - SCL
+//   4 - no-connect
+//   5 - GND
+// power the RTC from a GPIO pin
+#define RTC_PWR_PIN 16  // AKA "XPO" to module's Vdd
+#define SDA_PIN 2  // on ESP8266
+#define SCL_PIN 4
+
+
+// interval in ms to print the current time
+static unsigned long interval = 2000;
+
+
+
+RTC_DS3231 rtc;
+
+char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
+unsigned long lastMillis = 0;
+
+
+
+void setup () {
+
+#ifndef ESP8266
+  while (!Serial); // for Leonardo/Micro/Zero
+#endif
+
+  Serial.begin(115200);
+
+  // power the RTC from a GPIO
+  pinMode(RTC_PWR_PIN, OUTPUT);
+  digitalWrite(RTC_PWR_PIN, HIGH);
+  // setup the I2C pins for the RTC
+  Wire.begin(SDA_PIN, SCL_PIN);  // SDA, SCL
+
+  delay(3000); // wait for console opening
+
+  if (! rtc.begin()) {
+    Serial.println("Couldn't find RTC");
+    while (1);
+  }
+
+  Serial.println();
+  Serial.println("Set clock by sending a line of 6 integers:");
+  Serial.println("yyyy mm dd hh mm ss");
+}
+
+
+void loop () {
+  if (Serial.available()) {
+    // command line format:
+    //   yyyy mm dd hh mm ss
+    int year = Serial.parseInt();
+    int month = Serial.parseInt();
+    int day = Serial.parseInt();
+    int hour = Serial.parseInt();
+    int minute = Serial.parseInt();
+    int second = Serial.parseInt();
+
+    // get here as quickly as possible
+    rtc.adjust(DateTime(year, month, day, hour, minute, second));
+    Serial.print("Setting time to: ");
+    printDateTime(year, month, day, hour, minute, second);
+
+    // now consume the rest of the input line
+    Serial.readString();
+  }
+
+  // no delays in the loop so there is little delay between sending the time
+  // string and setting the RTC time
+  unsigned long currentMillis = millis();
+  if ((unsigned long)(currentMillis - lastMillis) >= interval) {
+    lastMillis = currentMillis;
+    DateTime now = rtc.now();
+    printDateTime(now.year(), now.month(), now.day(),
+                  now.hour(), now.minute(), now.second());
+  }
+}
+
+
+/*
+ * Utility function to print a datetime in RFC3339 format
+ * https://tools.ietf.org/html/rfc3339#page-6
+ */
+char *printDateTime(int year, int month, int day,
+                    int hour, int minute, int second)
+{
+  char buf[32];
+  sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02dZ",
+          year, month, day, hour, minute, second);
+  Serial.println(buf);
+}
+


Create IR2Keyboard.ino (#292)

Create IR2Keyboard.ino (#292)

Maybe useful 😀

error: pathspec 'IR2Keyboard.ino' did not match any file(s) known to git

--- IR2Keyboard.ino
+++ IR2Keyboard.ino
@@ -0,0 +1,155 @@
+/*
+this is just an example of creative (maybe useful) use of IR in a PC, as a media center or some other automatizations.
+the idea is fordward the IR commands (from any spare remote you may have) to keyboard pulses, combos, shortcuts, etc.
+Keyboard funtions only available on "leonardo" and "micro". for more keys read into  https://www.arduino.cc/en/Reference/KeyboardModifiers
+for IR decoding im using the amazing lib from:  http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html
+Remote class emulate media keys. need to be added manually to the arduino lib.  http://stefanjones.ca/blog/arduino-leonardo-remote-multimedia-keys/
+this is optional, you dont need Remote class to run the IR or Keyboard; its only for media keys
+ */
+
+
+ /*
+Remote methods:
+http://stefanjones.ca/blog/arduino-leonardo-remote-multimedia-keys/
+Volume
+  Remote.increase(void);
+  Remote.decrease(void);
+  Remote.mute(void);
+Playback
+  Remote.play(void);
+  Remote.pause(void);
+  Remote.stop(void);
+Track Controls
+  Remote.next(void);
+  Remote.previous(void);
+  Remote.forward(void);
+  Remote.rewind(void);
+Send an empty report to prevent repeated actions
+  Remote.clear();
+   */
+
+#include <IRremote.h>
+#define T 15
+int RECV_PIN = 2;
+IRrecv irrecv(RECV_PIN);
+decode_results results;
+//boolean flechas = false;
+boolean rotacion = false;
+
+void setup()
+{
+  pinMode(0,OUTPUT);
+  pinMode(1,OUTPUT);
+  digitalWrite(0,HIGH);
+  digitalWrite(1,LOW);//using pin 0 and 1 to power the IRreciver, pin 2 is serial input.
+  Serial.begin(57600);
+  Keyboard.begin();
+  irrecv.enableIRIn(); // Start the receiver
+}
+
+void loop() {
+  if (irrecv.decode(&results)) {
+    //DellRemote(results.value);
+    PanasonicRemote(results.value);
+    //mapping(results.value);
+    delay(300);//estaba en 100//500 es muy largo
+    irrecv.resume(); // Receive the next value
+  }
+  else{  delay(200);}//estaba en 100
+}
+
+void mapping(long code){
+  //use this funtion to map the codes of all your buttons. some buttons send different codes if they are hold down
+  if ((code == 0x801C2B2E) or (code == 0xB4AFB411) or (code == 0xD17D8037)){Serial.println("adelante/fordware button");  }
+  else if ((code == 0xB7AFB8C8) or (code == 0xD07D7EA2) or (code == 0x801CAB2F)){Serial.println("atras/previous button");  }
+  else {Serial.print(results.value, HEX); Serial.println("-----DESCONOCIDO/unkonw code! ");  }
+}
+
+void PanasonicRemote(long code){
+  //here i have mapped some buttons of my blueray remote.
+  if (code == 0xD00A0AD){/*adelante*/    Keyboard.releaseAll();delay(T); Keyboard.press(KEY_LEFT_ALT); Keyboard.press(KEY_RIGHT_ARROW); delay(T); Keyboard.releaseAll(); /*Remote.forward();  Remote.clear();*/}//Ctrl + ->    fordward 10 seconds VLC
+  else if (code == 0xD00202D){/*atras*/  Keyboard.releaseAll();delay(T);  Keyboard.press(KEY_LEFT_ALT); Keyboard.press(KEY_LEFT_ARROW); delay(T); Keyboard.releaseAll(); /*Remote.rewind();  Remote.clear();*/} //Ctrl + <-    rewind 10 seconds VLC
+  else if (code == 0xD00525F){/*next*/   Keyboard.releaseAll();delay(T);  Remote.next();  Remote.clear();}
+  else if (code == 0xD00929F){/*prev*/   Keyboard.releaseAll();delay(T);  Remote.previous();  Remote.clear();}
+  //else if (code == 0xD00000D){/*stop*/   Keyboard.releaseAll();delay(T);  Remote.stop();  Remote.clear();}
+  else if (code == 0x1000405){/*vol +*/    Keyboard.releaseAll();delay(T);Remote.increase();  Remote.clear();}
+  else if (code == 0x1008485){/*vol -*/    Keyboard.releaseAll();delay(T);Remote.decrease();  Remote.clear(); }
+  else if (code == 0xD00BCB1){/*POWER*/    Keyboard.releaseAll();delay(T);Remote.mute();  Remote.clear();}
+  else if ((code == 0xD00606D) or (code == 0xD00505D)){/*play/pause*/  Keyboard.releaseAll();delay(T);  Remote.play();  Remote.clear();}
+  else if (code == 0xD00818C){/*return*/   Keyboard.releaseAll(); delay(T); Keyboard.write(KEY_ESC);}
+  else if (code == 0xD00414C){/*OK*/       Keyboard.releaseAll(); delay(T); Keyboard.print(" "); /*evitar doble pulsaciondelay(300);*/}
+  else if (code == 0x100BCBD){/*tvPower*/  Keyboard.releaseAll();delay(T);Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_UP_ARROW); delay(T); Keyboard.releaseAll();}//volumen en VLC
+  else if (code == 0x100A0A1){/*input AV*/ Keyboard.releaseAll();delay(T);Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_DOWN_ARROW); delay(T); Keyboard.releaseAll();}//volumen en VLC
+  else if (code == 0xD00808D){/*open/close*/Keyboard.releaseAll();delay(T);Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_PAGE_UP); delay(T); Keyboard.releaseAll();}//cambiar canal HEXCHAT
+  else if (code == 0xD004944){/*display*/  Keyboard.releaseAll();delay(T);Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_PAGE_DOWN); delay(T); Keyboard.releaseAll();}//cambiar canal HEXCHAT
+  else if (code == 0xD803AB7){/*DLNA*/     if (rotacion){Keyboard.releaseAll();rotacion=false;delay(T);}
+                                           else{Keyboard.releaseAll(); delay(T); Keyboard.press(KEY_LEFT_GUI); delay(T); Keyboard.write(KEY_TAB);rotacion=true;}}
+                                           //rotation mode  //iniciar animacion de rotacion de ventanas  //start window rotation with compiz
+  else if (code == 0xD00A1AC){/*arrow up*/     Keyboard.write(KEY_UP_ARROW);}
+  else if (code == 0xD00616C){/*arrow down*/   Keyboard.releaseAll();delay(T);Keyboard.write(KEY_DOWN_ARROW);}
+  else if (code == 0xD00E1EC){/*arrow right*/  Keyboard.write(KEY_LEFT_ARROW);}
+  else if (code == 0xD00111C){/*arrow left*/   Keyboard.write(KEY_RIGHT_ARROW);}
+  else if (code == 0xD00D9D4){/*TOP MENU*/     Keyboard.print("f");}//f pone a pantalla completa en VLC    fullscreen
+  else if (code == 0xD00010C){/*S sub menu*/   Keyboard.print("v");}//v cambia subs en VLC   change subs
+  else if (code == 0xD00CCC1){/*AUDIO*/    Keyboard.print("b");}//b cambia audio en VLC    change audio track
+  else if (code == 0xD002825){/*#5*/       Keyboard.write(KEY_RETURN);}//useful to press enter on the file you want to play.
+  else {Serial.print(results.value, HEX); Serial.println("-----DESCONOCIDO!");  }
+}
+
+
+//void DellRemote(long code){
+//  if ((code == 0x801C2B2E) or (code == 0xB4AFB411) or (code == 0xD17D8037))
+//      {/*adelante*/    Keyboard.releaseAll();delay(T);flechas = false;Keyboard.press(KEY_LEFT_ALT); Keyboard.press(KEY_RIGHT_ARROW); delay(T); Keyboard.releaseAll(); /*Remote.forward();  Remote.clear();*/}
+//      //adelantar en VLC      forward
+//  else if ((code == 0xB7AFB8C8) or (code == 0xD07D7EA2) or (code == 0x801CAB2F))
+//      {/*atras*/       Keyboard.releaseAll();delay(T);flechas = false;Keyboard.press(KEY_LEFT_ALT); Keyboard.press(KEY_LEFT_ARROW); delay(T); Keyboard.releaseAll(); /*Remote.rewind();  Remote.clear();*/}
+//      //retroceder en VLC   backwards
+//
+//  else if ((code == 0x98BD82C2) or (code == 0xD218D2C)  or (code == 0xBD218D2C))
+//      {/*next*/   Keyboard.releaseAll();delay(T);flechas = false;Remote.next();  Remote.clear();}
+//  else if ((code == 0x7CA73789) or (code == 0x63D971B3) or (code == 0x801CAB21))
+//      {/*prev*/   Keyboard.releaseAll();delay(T);flechas = false;Remote.previous();  Remote.clear();}
+//  else if ((code == 0x851FCFD5) or (code == 0xB599B51F) or (code == 0x801CAB31))
+//      {/*stop*/   Keyboard.releaseAll();delay(T);flechas = false;Remote.stop();  Remote.clear();}
+//  else if ((code == 0x5ECE5800) or (code == 0x419B5F52) or (code == 0x801CAB2C))
+//      {/*play/pause*/  Keyboard.releaseAll();delay(T);flechas = false;Remote.play();  Remote.clear();}
+//  else if ((code == 0x948C3B0)  or (code == 0x17B591EA) or (code == 0x801CABA4))
+//      {/*backspace*/   Keyboard.write(KEY_ESC);delay(T);flechas = false;Keyboard.releaseAll();}
+//  else if ((code == 0x2AF7C446) or (code == 0x31D33AF4) or (code == 0x801CAB5C))
+//      {/*check*/      if(flechas){Keyboard.releaseAll();delay(T);flechas = false;}else{ Keyboard.print(" ");}}
+//
+//  else if ((code == 0x801CABCE) or (code == 0xC838DBEF) or (code == 0x11A1DED))
+//      {/*page up*/      Keyboard.releaseAll();delay(T);flechas = false;Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_UP_ARROW); delay(T); Keyboard.releaseAll();}
+//      //volumen en VLC
+//  else if ((code == 0x41A22A4)  or (code == 0xC738DA5A) or (code == 0x801CABCF))
+//      {/*page down*/   Keyboard.releaseAll();delay(T);flechas = false;Keyboard.press(KEY_LEFT_CTRL); Keyboard.press(KEY_DOWN_ARROW); delay(T); Keyboard.releaseAll();}
+//      //volumen en VLC
+//
+//  else if ((code == 0x1EBE32)   or (code == 0x529FB6FC) or (code == 0x801C2B10))
+//      {/*vol up*/      Keyboard.releaseAll();delay(T);flechas = false;Remote.increase();  Remote.clear();}
+//  else if ((code == 0x801CAB11) or (code == 0xA2AB03A3) or (code == 0xE48B8D9))
+//      {/*vol down*/     Keyboard.releaseAll();delay(T);flechas = false;Remote.decrease();  Remote.clear(); }
+//  else if ((code == 0xFB6B19B4) or (code == 0x1662CD72) or (code == 0x801C2B0D))
+//      {/*mute*/      Keyboard.releaseAll();delay(T);flechas = false;Remote.mute();  Remote.clear();}
+//
+//  else if ((code == 0x2E88114A) or (code == 0x4B9B7430) or (code == 0x801CAB58)){/*arrow up*/
+//  //iniciar animacion de rotacion de ventanas
+//  //start window rotation with compiz
+//      Keyboard.releaseAll();
+//      delay(T);
+//      Keyboard.write(KEY_UP_ARROW);
+//      Keyboard.press(KEY_LEFT_GUI);
+//      delay(T);
+//      Keyboard.write(KEY_TAB);flechas=true;}//rotation mode
+//
+//  else if ((code == 0x2EA26AFB) or (code == 0xAD79DDED) or (code == 0x801CAB59))
+//      {/*arrow down*/  Keyboard.releaseAll();delay(T);flechas = false;Keyboard.print("b");delay(T);Keyboard.write(KEY_DOWN_ARROW);}
+//      //b cambia audio en VLC    change audio track
+//  else if ((code == 0x3B726EB4) or (code == 0x54A4E562) or (code == 0x801C2B5B))
+//      {/*arrow right*/  if (flechas){Keyboard.write(KEY_LEFT_ARROW);}else{Keyboard.print("v");}}
+//      //v cambia subs en VLC   change subs
+//  else if ((code == 0x801CAB5A) or (code == 0x3C727047) or (code == 0x55A4E6F5))
+//      {/*arrow left*/  if (flechas){Keyboard.write(KEY_RIGHT_ARROW);}else{Keyboard.print("f");}}
+//      //f pone a pantalla completa en VLC    fullscreen
+//  //else {Serial.print(results.value, HEX); Serial.println("-----DESCONOCIDO!");  }
+//}


Initial commit with code

Initial commit with code

error: pathspec 'RF_receiver.ino' did not match any file(s) known to git

--- RF_receiver.ino
+++ RF_receiver.ino
@@ -0,0 +1,227 @@
+/*
+ Copyright (C) 2011 J. Coliz <maniacbug@ymail.com>
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+ */
+
+/**
+ * Example for Getting Started with nRF24L01+ radios.
+ *
+ * This is an example of how to use the RF24 class.  Write this sketch to two
+ * different nodes.  Put one of the nodes into 'transmit' mode by connecting
+ * with the serial monitor and sending a 'T'.  The ping node sends the current
+ * time to the pong node, which responds by sending the value back.  The ping
+ * node can then see how long the whole cycle took.
+ */
+
+#include <SPI.h>
+#include "nRF24L01.h"
+#include "RF24.h"
+#include "printf.h"
+
+//
+// Hardware configuration
+//
+
+// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
+
+RF24 radio(9,10);
+
+//
+// Topology
+//
+
+// Radio pipe addresses for the 2 nodes to communicate.
+const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };
+
+//
+// Role management
+//
+// Set up role.  This sketch uses the same software for all the nodes
+// in this system.  Doing so greatly simplifies testing.
+//
+
+// The various roles supported by this sketch
+typedef enum { role_ping_out = 1, role_pong_back } role_e;
+
+// The debug-friendly names of those roles
+const char* role_friendly_name[] = { "invalid", "Ping out", "Pong back"};
+
+// The role of the current running sketch
+role_e role = role_pong_back;
+
+void setup(void)
+{
+  //
+  // Print preamble
+  //
+
+  Serial.begin(57600);
+  printf_begin();
+  printf("\n\rRF24/examples/GettingStarted/\n\r");
+  printf("ROLE: %s\n\r",role_friendly_name[role]);
+  printf("*** PRESS 'T' to begin transmitting to the other node\n\r");
+
+  //
+  // Setup and configure rf radio
+  //
+
+  radio.begin();
+
+  // optionally, increase the delay between retries & # of retries
+  radio.setRetries(15,15);
+
+  // optionally, reduce the payload size.  seems to
+  // improve reliability
+  //radio.setPayloadSize(8);
+
+  //
+  // Open pipes to other nodes for communication
+  //
+
+  // This simple sketch opens two pipes for these two nodes to communicate
+  // back and forth.
+  // Open 'our' pipe for writing
+  // Open the 'other' pipe for reading, in position #1 (we can have up to 5 pipes open for reading)
+
+  //if ( role == role_ping_out )
+  {
+    //radio.openWritingPipe(pipes[0]);
+    radio.openReadingPipe(1,pipes[1]);
+  }
+  //else
+  {
+    //radio.openWritingPipe(pipes[1]);
+    //radio.openReadingPipe(1,pipes[0]);
+  }
+
+  //
+  // Start listening
+  //
+
+  radio.startListening();
+
+  //
+  // Dump the configuration of the rf unit for debugging
+  //
+
+  radio.printDetails();
+}
+
+void loop(void)
+{
+  //
+  // Ping out role.  Repeatedly send the current time
+  //
+
+  if (role == role_ping_out)
+  {
+    // First, stop listening so we can talk.
+    radio.stopListening();
+
+    // Take the time, and send it.  This will block until complete
+    unsigned long time = millis();
+    printf("Now sending %lu...",time);
+    bool ok = radio.write( &time, sizeof(unsigned long) );
+
+    if (ok)
+      printf("ok...");
+    else
+      printf("failed.\n\r");
+
+    // Now, continue listening
+    radio.startListening();
+
+    // Wait here until we get a response, or timeout (250ms)
+    unsigned long started_waiting_at = millis();
+    bool timeout = false;
+    while ( ! radio.available() && ! timeout )
+      if (millis() - started_waiting_at > 200 )
+        timeout = true;
+
+    // Describe the results
+    if ( timeout )
+    {
+      printf("Failed, response timed out.\n\r");
+    }
+    else
+    {
+      // Grab the response, compare, and send to debugging spew
+      unsigned long got_time;
+      radio.read( &got_time, sizeof(unsigned long) );
+
+      // Spew it
+      printf("Got response %lu, round-trip delay: %lu\n\r",got_time,millis()-got_time);
+    }
+
+    // Try again 1s later
+    delay(1000);
+  }
+
+  //
+  // Pong back role.  Receive each packet, dump it out, and send it back
+  //
+
+  if ( role == role_pong_back )
+  {
+    // if there is data ready
+    if ( radio.available() )
+    {
+      // Dump the payloads until we've gotten everything
+      unsigned long got_time;
+      bool done = false;
+      while (!done)
+      {
+        // Fetch the payload, and see if this was the last one.
+        done = radio.read( &got_time, sizeof(unsigned long) );
+
+        // Spew it
+        printf("Got payload %lu...",got_time);
+
+	// Delay just a little bit to let the other unit
+	// make the transition to receiver
+	delay(20);
+      }
+
+      // First, stop listening so we can talk
+      radio.stopListening();
+
+      // Send the final one back.
+      radio.write( &got_time, sizeof(unsigned long) );
+      printf("Sent response.\n\r");
+
+      // Now, resume listening so we catch the next packets.
+      radio.startListening();
+    }
+  }
+
+  //
+  // Change roles
+  //
+
+  if ( Serial.available() )
+  {
+    char c = toupper(Serial.read());
+    if ( c == 'T' && role == role_pong_back )
+    {
+      printf("*** CHANGING TO TRANSMIT ROLE -- PRESS 'R' TO SWITCH BACK\n\r");
+
+      // Become the primary transmitter (ping out)
+      role = role_ping_out;
+      radio.openWritingPipe(pipes[0]);
+      radio.openReadingPipe(1,pipes[1]);
+    }
+    else if ( c == 'R' && role == role_ping_out )
+    {
+      printf("*** CHANGING TO RECEIVE ROLE -- PRESS 'T' TO SWITCH BACK\n\r");
+
+      // Become the primary receiver (pong back)
+      role = role_pong_back;
+      radio.openWritingPipe(pipes[1]);
+      radio.openReadingPipe(1,pipes[0]);
+    }
+  }
+}
+// vim:cin:ai:sts=2 sw=2 ft=cpp


Change Length

Change Length

/bin/sh: 1: Syntax error: "(" unexpected


aggiunto simulatore eth

aggiunto simulatore eth

error: pathspec 'mqtt_simulatore_eth/mqtt_simulatore_eth.ino' did not match any file(s) known to git

--- mqtt_simulatore_eth/mqtt_simulatore_eth.ino
+++ mqtt_simulatore_eth/mqtt_simulatore_eth.ino
@@ -0,0 +1,112 @@
+
+/*
+ Basic MQTT example
+
+ This sketch demonstrates the basic capabilities of the library.
+ It connects to an MQTT server then:
+  - publishes "hello world" to the topic "outTopic"
+  - subscribes to the topic "inTopic", printing out any messages
+    it receives. NB - it assumes the received payloads are strings not binary
+
+ It will reconnect to the server if the connection is lost using a blocking
+ reconnect function. See the 'mqtt_reconnect_nonblocking' example for how to
+ achieve the same result without blocking the main loop.
+
+*/
+
+#include <SPI.h>
+#include <Ethernet.h>
+#include <PubSubClient.h>
+
+String puntoAcq;
+String temp;
+String terUm;
+String AriaUm;
+String timeAcq;
+
+long lastMsg = 0;
+char msg[50];
+int value = 0;
+
+
+// Update these with values suitable for your network.
+byte mac[]    = {  0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
+IPAddress ip(192, 168, 1, 101);
+IPAddress server(192, 168, 1, 69);
+
+void callback(char* topic, byte* payload, unsigned int length) {
+  Serial.print("Message arrived [");
+  Serial.print(topic);
+  Serial.print("] ");
+  for (int i=0;i<length;i++) {
+    Serial.print((char)payload[i]);
+  }
+  Serial.println();
+}
+
+EthernetClient ethClient;
+PubSubClient client(ethClient);
+
+void reconnect() {
+  // Loop until we're reconnected
+  while (!client.connected()) {
+    Serial.print("Attempting MQTT connection...");
+    // Attempt to connect
+    if (client.connect("arduinoClient")) {
+      Serial.println("connected");
+
+      // ... and resubscribe
+      client.subscribe("acqDati");
+    } else {
+      Serial.print("failed, rc=");
+      Serial.print(client.state());
+      Serial.println(" try again in 5 seconds");
+      // Wait 5 seconds before retrying
+      delay(5000);
+    }
+  }
+}
+
+void setup()
+{
+  Serial.begin(57600);
+
+  client.setServer(server, 1883);
+  client.setCallback(callback);
+
+  Ethernet.begin(mac, ip);
+  // Allow the hardware to sort itself out
+  delay(1500);
+}
+
+void loop()
+{
+  if (!client.connected()) {
+    reconnect();
+  }
+  client.loop();
+
+
+
+  puntoAcq = String(random(1,4));
+  temp = String(random(-40,50));
+  terUm = String(random(0, 1024));
+  AriaUm = String(random(0, 1024));
+  timeAcq = String(random(1,31)) + "/"+ String(random(1,13)) + "/" + String(2018);
+
+
+  String msg= puntoAcq + ',' + temp + ',' + terUm + ',' + AriaUm + ',' + timeAcq;
+
+  long now = millis();
+  if (now - lastMsg > 2000) {
+    lastMsg = now;
+    ++value;
+    Serial.print("messaggio pubblicato: ");
+    Serial.println(msg);
+    char buf[64];
+    msg.toCharArray(buf, 64);
+    client.publish("acqDati", buf);
+
+}
+}
+


Firmware to turn the weapon on

Firmware to turn the weapon on

error: pathspec 'SOURCE/combat/weapon/weapon.ino' did not match any file(s) known to git

--- SOURCE/combat/weapon/weapon.ino
+++ SOURCE/combat/weapon/weapon.ino
@@ -0,0 +1,33 @@
+#define LED_SAT 2
+#define RELAY 1
+#define PPM 3
+
+void setup() {
+  // initialize digital pin 13 as an output.
+  pinMode(LED_SAT, OUTPUT);
+  pinMode(RELAY, OUTPUT);
+  pinMode(PPM, INPUT);
+  digitalWrite(LED_SAT, LOW);
+  digitalWrite(RELAY, LOW);
+}
+
+void loop() {
+  // PPM
+  int pulse_width = pulseIn(PPM, HIGH);
+
+  // SAT LED
+  if(500 < pulse_width && pulse_width < 2500){
+    digitalWrite(LED_SAT, HIGH);   // turn the LED on (HIGH is the voltage level)
+  }else{
+    digitalWrite(LED_SAT, LOW);
+    digitalWrite(RELAY, LOW); // fail safe
+    return;
+  }
+
+  // RELAY
+  if(1650 < pulse_width && pulse_width < 2500){
+    digitalWrite(RELAY, HIGH);
+  }else{
+    digitalWrite(RELAY, LOW); // fail safe
+  }
+}


Add Apple Remote example

Add Apple Remote example

error: pathspec 'examples/hexbug_apple_remote/hexbug_apple_remote.ino' did not match any file(s) known to git

--- examples/hexbug_apple_remote/hexbug_apple_remote.ino
+++ examples/hexbug_apple_remote/hexbug_apple_remote.ino
@@ -0,0 +1,94 @@
+#include <AppleRemote.h>
+
+#include <hexbug_spider.h>
+
+#define SIGNAL_MAX_LENGTH 70
+
+#define PIN_IR_INPUT      2
+#define PIN_IR_OUTPUT     3
+
+int last_code = 0;
+
+unsigned int signal[SIGNAL_MAX_LENGTH];
+
+IRDump *irdumper;
+AppleRemote *appleRemote;
+
+void setup()
+{
+  Serial.begin(115200);
+  Serial.println("Apple Remote for Arduino.");
+
+  appleRemote = new AppleRemote(PIN_IR_OUTPUT, APPLE_REMOTE_MODEL_A);
+  irdumper = new IRDump();
+}
+
+void receive_signals() {
+  unsigned int *s = signal;
+
+  bool captured;
+  int code;
+
+  code = 0;
+
+  captured = irdumper->Capture(PIN_IR_INPUT, s, SIGNAL_MAX_LENGTH, 9500);
+
+  if (captured) {
+    code = appleRemote->Match(s);
+
+    switch (code) {
+      case APPLE_REMOTE_RIGHT:
+        Serial.println("[right]");
+        break;
+      case APPLE_REMOTE_LEFT:
+        Serial.println("[left]");
+        break;
+      case APPLE_REMOTE_UP:
+        Serial.println("[up]");
+        break;
+      case APPLE_REMOTE_DOWN:
+        Serial.println("[down]");
+        break;
+      case APPLE_REMOTE_REPEAT:
+        Serial.println("[repeat]");
+        code = last_code;
+        break;
+      default:
+        Serial.println("[?]");
+        code = 0;
+        return;
+    }
+
+    if (code > 0) {
+
+      int i;
+
+      for (i = 0; i < 5; i++) {
+        switch (code) {
+          case APPLE_REMOTE_RIGHT:
+            hexbug_spider_right();
+            break;
+          case APPLE_REMOTE_LEFT:
+            hexbug_spider_left();
+            break;
+          case APPLE_REMOTE_UP:
+            hexbug_spider_forward();
+            break;
+          case APPLE_REMOTE_DOWN:
+            hexbug_spider_backward();
+            break;
+          default:
+            return;
+        }
+        delay(50);
+      }
+
+      last_code = code;
+    }
+  }
+}
+
+
+void loop() {
+  receive_signals();
+}


Light optimalisations Master

Light optimalisations Master

error: pathspec 'SmartKitchen-Emdebbed' did not match any file(s) known to git
error: pathspec 'System/Software/Arduino/Final_Main_Master/Final_Main_Master.ino' did not match any file(s) known to git


Pushbutton example

Pushbutton example

error: pathspec 'Valokepakko.ino' did not match any file(s) known to git

--- Valokepakko.ino
+++ Valokepakko.ino
@@ -0,0 +1,41 @@
+const int BUTTON_PIN = 12;
+const int LED_PIN = 13;
+
+// See https://www.arduino.cc/en/Tutorial/StateChangeDetection
+
+void setup() {
+  // Initialize the button pin as a input.
+  pinMode(BUTTON_PIN, INPUT);
+  // initialize the LED as an output.
+  pinMode(LED_PIN, OUTPUT);
+  // Initialize serial communication for debugging.
+  Serial.begin(9600);
+
+}
+
+int buttonState = 0;
+int lastButtonState = 0;
+
+
+void loop() {
+  buttonState = digitalRead(BUTTON_PIN);
+
+  if (buttonState != lastButtonState) {
+    if (buttonState == HIGH) {
+      // If the current state is HIGH then the button
+      // went from off to on:
+      Serial.println("on");
+
+      // Light the LED.
+      digitalWrite(LED_PIN, HIGH);
+      delay(100);
+      digitalWrite(LED_PIN, LOW);
+
+    } else {
+      Serial.println("off");
+    }
+    // Delay a little bit to avoid bouncing.
+    delay(50);
+  }
+  lastButtonState = buttonState;
+}


Initial check-in of Oscilloscope.

Initial check-in of Oscilloscope.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/JulianNicholls/Arduino.git/'


Added the AccelStepper example.

Added the AccelStepper example.

error: pathspec 'examples/AccelStepper/AccelStepper.ino' did not match any file(s) known to git

--- examples/AccelStepper/AccelStepper.ino
+++ examples/AccelStepper/AccelStepper.ino
@@ -0,0 +1,50 @@
+/* This example shows how to use the AMIS-30543 stepper motor
+driver with the AccelStepper library.
+
+You will need to install the AccelStepper library for this
+example to work.  Documentation and installation instructions for
+the AccelStepper library are available here:
+
+    http://www.airspayce.com/mikem/arduino/AccelStepper/
+
+Before using this example, be sure to change the
+setCurrentMilliamps line to have an appropriate current limit for
+your system.  Also, see this library's documentation for
+information about how to connect the driver:
+
+    http://pololu.github.io/amis-30543-arduino/
+*/
+
+#include <SPI.h>
+#include <AMIS30543.h>
+#include <AccelStepper.h>
+
+const uint8_t amisDirPin = 2;
+const uint8_t amisStepPin = 3;
+const uint8_t amisSlaveSelect = 4;
+
+AMIS30543 stepper;
+AccelStepper accelStepper(AccelStepper::DRIVER, amisStepPin, amisDirPin);
+
+void setup()
+{
+  SPI.begin();
+  stepper.init(amisSlaveSelect);
+  delay(1);
+
+  stepper.resetSettings();
+  stepper.setCurrentMilliamps(132);
+  stepper.setStepMode(32);
+  stepper.enableDriver();
+
+  accelStepper.setMaxSpeed(2000.0);
+  accelStepper.setAcceleration(500.0);
+}
+
+void loop()
+{
+  accelStepper.runToNewPosition(0);
+  delay(500);
+  accelStepper.runToNewPosition(10000);
+  delay(500);
+}


Update EEPROMCalibrationFutabaT8FGSuperSketch.ino

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/HarrisonOfTheNorth/BitChannels.git/'


Create Mimic_LED_Controller_reduced_brightness.ino

Reduced brigthness version

error: pathspec 'Arduino/Mimic_LED_Controller_reduced_brightness/Mimic_LED_Controller_reduced_brightness.ino' did not match any file(s) known to git

--- Arduino/Mimic_LED_Controller_reduced_brightness/Mimic_LED_Controller_reduced_brightness.ino
+++ Arduino/Mimic_LED_Controller_reduced_brightness/Mimic_LED_Controller_reduced_brightness.ino
@@ -0,0 +1,569 @@
+#include <Adafruit_NeoPixel.h>
+#include <string.h>
+//Connect USB port to Pi USB Port
+//For serial debugging - connect to the RX1 and TX1 pins
+//Adafruit_NeoPixel stbdIEA = Adafruit_NeoPixel(24, 5, NEO_GRB + NEO_KHZ800);
+//Adafruit_NeoPixel portIEA = Adafruit_NeoPixel(24, 6, NEO_GRB + NEO_KHZ800);
+//Adafruit_NeoPixel moduleLED = Adafruit_NeoPixel(16, 7, NEO_GRB + NEO_KHZ800);
+Adafruit_NeoPixel stbdIEA = Adafruit_NeoPixel(24, 3, NEO_GRB);
+Adafruit_NeoPixel portIEA = Adafruit_NeoPixel(24, 5, NEO_GRB);
+Adafruit_NeoPixel moduleLED = Adafruit_NeoPixel(16, 7, NEO_GRB);
+const int ledRedPin = 13;
+const int ledBluePin = 52;
+const int ledGreenPin = 53;
+String test;
+
+double V1A = 0.00;
+double V1B = 0.00;
+double V3A = 0.00;
+double V3B = 0.00;
+double V2A = 0.00;
+double V2B = 0.00;
+double V4A = 0.00;
+double V4B = 0.00;
+String module = "unset module";
+boolean Disco = false;
+int NULLIFY = 0;
+
+void setup()
+{
+  pinMode(ledRedPin, OUTPUT);
+  pinMode(ledBluePin, OUTPUT);
+  pinMode(ledGreenPin, OUTPUT);
+//  Serial1.begin(9600);
+  Serial.begin(9600);
+  Serial.setTimeout(50);
+  portIEA.begin();
+  stbdIEA.begin();
+  moduleLED.begin();
+  portIEA.show();
+  stbdIEA.show();
+  moduleLED.show();
+  allSet_module(moduleLED.Color(111,0,0),5);
+}
+
+void loop()
+{
+  digitalWrite(ledRedPin, LOW);
+  digitalWrite(ledGreenPin, LOW);
+  digitalWrite(ledBluePin, LOW);
+  //wSerial1.println("-------");
+  if(Serial.available())
+  {
+    checkSerial();
+  }
+  allSet_module(moduleLED.Color(0,0,0),0);
+  //Serial1.println(module);
+  if(module == "SM")
+  {
+    moduleLED.setPixelColor(0, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("SM");
+  }
+  else if(module == "FGB")
+  {
+    moduleLED.setPixelColor(1, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("FGB");
+  }
+  else if(module == "Node1")
+  {
+    moduleLED.setPixelColor(2, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("Node1");
+  }
+  else if(module == "Node2")
+  {
+    moduleLED.setPixelColor(6, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("Node2");
+  }
+  else if(module == "Node3")
+  {
+    moduleLED.setPixelColor(4, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("Node3");
+  }
+  else if(module == "AL")
+  {
+    moduleLED.setPixelColor(3, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("AL");
+  }
+  else if(module == "USL")
+  {
+    moduleLED.setPixelColor(5, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("USL");
+  }
+  else if(module == "Col")
+  {
+    moduleLED.setPixelColor(7, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("Col");
+  }
+  else if(module == "JEM")
+  {
+    moduleLED.setPixelColor(8, moduleLED.Color(111,111,111));
+    moduleLED.show();
+    //Serial1.println("JEM");
+  }
+  else
+  {
+    allSet_module(moduleLED.Color(0,0,0),0);
+    moduleLED.show();
+  }
+
+  if(V2A < 151.5)
+  {
+    portIEA.setPixelColor(0, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(1, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(2, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(3, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(4, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(5, portIEA.Color(111,0,0));
+    portIEA.show();
+  }
+  else if(V2A > 160)
+  {
+    portIEA.setPixelColor(0, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(1, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(2, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(3, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(4, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(5, portIEA.Color(111,111,111));
+    portIEA.show();
+  }
+  else
+  {
+    portIEA.setPixelColor(0, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(1, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(2, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(3, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(4, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(5, portIEA.Color(0,0,111));
+    portIEA.show();
+  }
+
+  if(V4A < 151.5)
+  {
+    portIEA.setPixelColor(6, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(7, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(8, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(9, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(10, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(11, portIEA.Color(111,0,0));
+    portIEA.show();
+  }
+  else if(V4A > 160)
+  {
+    portIEA.setPixelColor(6, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(7, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(8, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(9, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(10, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(11, portIEA.Color(111,111,111));
+    portIEA.show();
+  }
+  else
+  {
+    portIEA.setPixelColor(6, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(7, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(8, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(9, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(10, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(11, portIEA.Color(0,0,111));
+    portIEA.show();
+  }
+
+  if(V4B < 151.5)
+  {
+    portIEA.setPixelColor(12, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(13, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(14, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(15, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(16, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(17, portIEA.Color(111,0,0));
+    portIEA.show();
+  }
+  else if(V4B > 160)
+  {
+    portIEA.setPixelColor(12, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(13, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(14, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(15, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(16, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(17, portIEA.Color(111,111,111));
+    portIEA.show();
+  }
+  else
+  {
+    portIEA.setPixelColor(12, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(13, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(14, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(15, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(16, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(17, portIEA.Color(0,0,111));
+    portIEA.show();
+  }
+
+  if(V2B < 151.5)
+  {
+    portIEA.setPixelColor(18, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(19, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(20, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(21, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(22, portIEA.Color(111,0,0));
+    portIEA.setPixelColor(23, portIEA.Color(111,0,0));
+    portIEA.show();
+  }
+  else if(V2B > 160)
+  {
+    portIEA.setPixelColor(18, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(19, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(20, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(21, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(22, portIEA.Color(111,111,111));
+    portIEA.setPixelColor(23, portIEA.Color(111,111,111));
+    portIEA.show();
+  }
+  else
+  {
+    portIEA.setPixelColor(18, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(19, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(20, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(21, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(22, portIEA.Color(0,0,111));
+    portIEA.setPixelColor(23, portIEA.Color(0,0,111));
+    portIEA.show();
+  }
+  if(V1A < 151.5)
+  {
+    stbdIEA.setPixelColor(0, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(1, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(2, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(3, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(4, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(5, stbdIEA.Color(111,0,0));
+    stbdIEA.show();
+  }
+  else if(V1A > 160)
+  {
+    stbdIEA.setPixelColor(0, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(1, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(2, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(3, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(4, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(5, stbdIEA.Color(111,111,111));
+    stbdIEA.show();
+  }
+  else
+  {
+    stbdIEA.setPixelColor(0, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(1, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(2, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(3, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(4, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(5, stbdIEA.Color(0,0,111));
+    stbdIEA.show();
+  }
+
+  if(V3A < 151.5)
+  {
+    stbdIEA.setPixelColor(6, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(7, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(8, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(9, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(10, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(11, stbdIEA.Color(111,0,0));
+    stbdIEA.show();
+  }
+  else if(V3A > 160)
+  {
+    stbdIEA.setPixelColor(6, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(7, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(8, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(9, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(10, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(11, stbdIEA.Color(111,111,111));
+    stbdIEA.show();
+  }
+  else
+  {
+    stbdIEA.setPixelColor(6, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(7, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(8, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(9, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(10, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(11, stbdIEA.Color(0,0,111));
+    stbdIEA.show();
+  }
+
+  if(V3B < 151.5)
+  {
+    stbdIEA.setPixelColor(12, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(13, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(14, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(15, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(16, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(17, stbdIEA.Color(111,0,0));
+    stbdIEA.show();
+  }
+  else if(V3B > 160)
+  {
+    stbdIEA.setPixelColor(12, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(13, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(14, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(15, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(16, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(17, stbdIEA.Color(111,111,111));
+    stbdIEA.show();
+  }
+  else
+  {
+    stbdIEA.setPixelColor(12, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(13, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(14, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(15, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(16, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(17, stbdIEA.Color(0,0,111));
+    stbdIEA.show();
+  }
+
+  if(V1B < 151.5)
+  {
+    stbdIEA.setPixelColor(18, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(19, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(20, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(21, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(22, stbdIEA.Color(111,0,0));
+    stbdIEA.setPixelColor(23, stbdIEA.Color(111,0,0));
+    stbdIEA.show();
+  }
+  else if(V1B > 160)
+  {
+    stbdIEA.setPixelColor(18, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(19, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(20, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(21, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(22, stbdIEA.Color(111,111,111));
+    stbdIEA.setPixelColor(23, stbdIEA.Color(111,111,111));
+    stbdIEA.show();
+  }
+  else
+  {
+    stbdIEA.setPixelColor(18, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(19, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(20, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(21, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(22, stbdIEA.Color(0,0,111));
+    stbdIEA.setPixelColor(23, stbdIEA.Color(0,0,111));
+    stbdIEA.show();
+  }
+  if(Disco)
+  {
+    theaterChaseRainbow_portIEA(50);
+    theaterChaseRainbow_stbdIEA(50);
+  }
+  Disco = false;
+}
+void checkSerial()
+{
+  digitalWrite(ledBluePin, HIGH);
+  test = "";
+
+  while(Serial.available() > 0)
+  {
+    test = Serial.readStringUntil('\n');
+    //test = Serial.readString();
+  }
+//  Serial1.println(test);
+
+  char sz[test.length() + 1];
+  char copy[test.length() + 1];
+  strcpy(sz, test.c_str());
+  char *p = sz;
+  char *str;
+  int delimeter = 0;
+  String test2 = "";
+
+  while((str = strtok_r(p," ",&p))!=NULL)
+  {
+    test2 = String(str);
+    delimeter = test2.indexOf('=');
+    if(test2.substring(0,delimeter)=="Disco")
+    {
+      Disco = true;
+    }
+    else if (test2.substring(0, delimeter) == "NULLIFY")
+    {
+      NULLIFY = int((test2.substring(delimeter + 1)).toFloat());
+          Serial.println(" Got the NULL cmd over Serial...");
+    }
+    if(test2.substring(0,delimeter)=="Voltage2A")
+    {
+      V2A = (test2.substring(delimeter+1)).toFloat();
+    }
+    else if(test2.substring(0,delimeter)=="Voltage2B")
+    {
+      V2B = (test2.substring(delimeter+1)).toFloat();
+    }
+    else if(test2.substring(0,delimeter)=="Voltage4A")
+    {
+      V4A = (test2.substring(delimeter+1)).toFloat();
+    }
+    else if(test2.substring(0,delimeter)=="Voltage4B")
+    {
+      V4B = (test2.substring(delimeter+1)).toFloat();
+    }
+    else if(test2.substring(0,delimeter)=="Voltage1A")
+    {
+      V1A = (test2.substring(delimeter+1)).toFloat();
+    }
+    else if(test2.substring(0,delimeter)=="Voltage1B")
+    {
+      V1B = (test2.substring(delimeter+1)).toFloat();
+    }
+    else if(test2.substring(0,delimeter)=="Voltage3A")
+    {
+      V3A = (test2.substring(delimeter+1)).toFloat();
+    }
+    else if(test2.substring(0,delimeter)=="Voltage3B")
+    {
+      V3B = (test2.substring(delimeter+1)).toFloat();
+    }
+    //module Selection
+    else if(test2.substring(0,delimeter)=="Module")
+    {
+      //Serial1.println("----Module!------");
+      module = (test2.substring(delimeter+1));
+    }
+  }
+//  Serial1.println();
+}
+
+//module led functions
+void allSet_module(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<moduleLED.numPixels(); i++)
+  {
+    moduleLED.setPixelColor(i, c);
+    moduleLED.show();
+    delay(wait);
+  }
+}
+void theaterChaseRainbow_Module(uint8_t wait) {
+  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
+    for (int q=0; q < 3; q++) {
+      for (uint16_t i=0; i < moduleLED.numPixels(); i=i+3) {
+        moduleLED.setPixelColor(i+q, Wheel_Module( (i+j) % 111));    //turn every third pixel on
+      }
+      moduleLED.show();
+
+      delay(wait);
+
+      for (uint16_t i=0; i < moduleLED.numPixels(); i=i+3) {
+        moduleLED.setPixelColor(i+q, 0);        //turn every third pixel off
+      }
+    }
+  }
+}
+
+// Input a value 0 to 111 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel_Module(byte WheelPos) {
+  WheelPos = 111 - WheelPos;
+  if(WheelPos < 85) {
+    return moduleLED.Color(111 - WheelPos * 3, 0, WheelPos * 3);
+  }
+  if(WheelPos < 170) {
+    WheelPos -= 85;
+    return moduleLED.Color(0, WheelPos * 3, 111 - WheelPos * 3);
+  }
+  WheelPos -= 170;
+  return moduleLED.Color(WheelPos * 3, 111 - WheelPos * 3, 0);
+}
+
+//port IEA led functions
+void allSet_portIEA(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<portIEA.numPixels(); i++)
+  {
+    portIEA.setPixelColor(i, c);
+    portIEA.show();
+    delay(wait);
+  }
+}
+
+void theaterChaseRainbow_portIEA(uint8_t wait) {
+  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
+    for (int q=0; q < 3; q++) {
+      for (uint16_t i=0; i < portIEA.numPixels(); i=i+3) {
+        portIEA.setPixelColor(i+q, Wheel_portIEA( (i+j) % 111));    //turn every third pixel on
+      }
+      portIEA.show();
+
+      delay(wait);
+
+      for (uint16_t i=0; i < portIEA.numPixels(); i=i+3) {
+        portIEA.setPixelColor(i+q, 0);        //turn every third pixel off
+      }
+    }
+  }
+}
+
+// Input a value 0 to 111 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel_portIEA(byte WheelPos) {
+  WheelPos = 111 - WheelPos;
+  if(WheelPos < 85) {
+    return portIEA.Color(111 - WheelPos * 3, 0, WheelPos * 3);
+  }
+  if(WheelPos < 170) {
+    WheelPos -= 85;
+    return portIEA.Color(0, WheelPos * 3, 111 - WheelPos * 3);
+  }
+  WheelPos -= 170;
+  return portIEA.Color(WheelPos * 3, 111 - WheelPos * 3, 0);
+}
+
+
+//stbd IEA led functions
+void allSet_stbdIEA(uint32_t c, uint8_t wait) {
+  for(uint16_t i=0; i<stbdIEA.numPixels(); i++)
+  {
+    stbdIEA.setPixelColor(i, c);
+    stbdIEA.show();
+    delay(wait);
+  }
+}
+
+void theaterChaseRainbow_stbdIEA(uint8_t wait) {
+  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
+    for (int q=0; q < 3; q++) {
+      for (uint16_t i=0; i < stbdIEA.numPixels(); i=i+3) {
+        stbdIEA.setPixelColor(i+q, Wheel_stbdIEA( (i+j) % 111));    //turn every third pixel on
+      }
+      stbdIEA.show();
+
+      delay(wait);
+
+      for (uint16_t i=0; i < stbdIEA.numPixels(); i=i+3) {
+        stbdIEA.setPixelColor(i+q, 0);        //turn every third pixel off
+      }
+    }
+  }
+}
+
+// Input a value 0 to 111 to get a color value.
+// The colours are a transition r - g - b - back to r.
+uint32_t Wheel_stbdIEA(byte WheelPos) {
+  WheelPos = 111 - WheelPos;
+  if(WheelPos < 85) {
+    return stbdIEA.Color(111 - WheelPos * 3, 0, WheelPos * 3);
+  }
+  if(WheelPos < 170) {
+    WheelPos -= 85;
+    return stbdIEA.Color(0, WheelPos * 3, 111 - WheelPos * 3);
+  }
+  WheelPos -= 170;
+  return stbdIEA.Color(WheelPos * 3, 111 - WheelPos * 3, 0);
+}


Create memmove8_pattern_mirrored.ino

Create memmove8_pattern_mirrored.ino

error: pathspec 'memmove8_pattern_mirrored.ino' did not match any file(s) known to git

--- memmove8_pattern_mirrored.ino
+++ memmove8_pattern_mirrored.ino
@@ -0,0 +1,90 @@
+//***************************************************************
+// Messing around based on someone's question about reversing
+// the order of a range of pixels.
+// Builds on my memmove8_pattern_copy.ino example.  Please see
+// that sketch for more info and comments.
+//
+// Marc Miller, April 2020
+//***************************************************************
+
+
+#include "FastLED.h"
+#define LED_TYPE LPD8806
+#define DATA_PIN 11
+#define CLOCK_PIN 13
+#define COLOR_ORDER GRB
+#define BRIGHTNESS 100
+#define NUM_LEDS 32
+CRGB leds[NUM_LEDS];
+
+const uint8_t patternMinLength = 3;
+const uint8_t patternMaxLength = 12;
+CRGB mirroredLeds[patternMaxLength];
+
+uint8_t hue;
+
+//---------------------------------------------------------------
+void setup() {
+  Serial.begin(115200);  // Allows serial monitor output (check baud rate)
+  delay(2000);  // Startup delay
+  FastLED.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, COLOR_ORDER>(leds, NUM_LEDS);
+  FastLED.setBrightness(BRIGHTNESS);
+  FastLED.clear();
+  FastLED.show();
+  Serial.println("Setup done.  \n");
+}
+
+
+//---------------------------------------------------------------
+void loop() {
+
+  repeatingPatternMirrored();
+  FastLED.show();
+
+}//end_main_loop
+
+
+//---------------------------------------------------------------
+void repeatingPatternMirrored() {
+  static uint8_t patternLength = 4;  // This changes [random number between pattern Min and Max length]
+  static uint8_t pRepeat = NUM_LEDS / patternLength;
+  static uint8_t pDiff = NUM_LEDS % patternLength;
+
+  EVERY_N_SECONDS(10) {
+    random16_add_entropy(random16() + analogRead(A0));
+    patternLength = random8(patternMinLength,patternMaxLength+1);
+    pRepeat = NUM_LEDS / patternLength;
+    pDiff = NUM_LEDS % patternLength;
+    Serial.print("patternLength: "); Serial.println(patternLength);
+    hue = hue + random8(100,160);
+  }
+
+  fill_rainbow( leds, patternLength, hue + (millis()/40), 10 );
+  leds[0] += CHSV(hue+128,255,190);  // optional visual to help see repeat of pattern
+  memmove8( &mirroredLeds[0], &leds[0], (patternLength)*sizeof(CRGB) );  // copy pattern to mirroredLeds array
+
+  // mirror pixels in CRGB mirroredLeds array
+  for (uint8_t i=0; i<patternLength/2; i++) {
+    CRGB temp = mirroredLeds[i];
+    mirroredLeds[i] = mirroredLeds[patternLength-1-i];
+    mirroredLeds[patternLength-1-i] = temp;
+  }
+
+  for (uint8_t i=0; i < pRepeat; i++) {
+    if ( mod8(i,2) == 0) {
+      memmove8( &leds[i*patternLength], &leds[0], (patternLength)*sizeof(CRGB) );
+    } else {
+      memmove8( &leds[i*patternLength], &mirroredLeds[0], (patternLength)*sizeof(CRGB) );
+    }
+  }
+
+  if (pDiff != 0) {  // copy the remaining pixels
+    if ( mod8(pRepeat,2) == 0) {
+      memmove8( &leds[NUM_LEDS - pDiff], &leds[0], (pDiff)*sizeof(CRGB) );
+    } else {
+      memmove8( &leds[NUM_LEDS - pDiff], &mirroredLeds[0], (pDiff)*sizeof(CRGB) );
+    }
+  }
+
+}//end_CopyPixels
+


Create Pad_A_Piano.ino

Create Pad_A_Piano.ino

error: pathspec 'Musical_Instruments_2017_2018/Dance_Pads/Pad_A_Piano.ino' did not match any file(s) known to git

--- Musical_Instruments_2017_2018/Dance_Pads/Pad_A_Piano.ino
+++ Musical_Instruments_2017_2018/Dance_Pads/Pad_A_Piano.ino
@@ -0,0 +1,118 @@
+#include <Math.h>
+#include <Keyboard.h>
+#include <MIDI.h>
+
+// Set up variables for dance pad input
+int bass= 2;
+int hHat = 3;
+int hTom = 4;
+int mTom = 5;
+int ride = 6;
+int snare = 7;
+int lTom = 8;
+int crash = 9;
+
+// Set up default variables for input status
+int valBass = 0;
+int valhHat = 0;
+int valhTom = 0;
+int valmTom = 0;
+int valRide = 0;
+int valSnare = 0;
+int vallTom = 0;
+int valCrash = 0;
+
+// variable to store the value read
+
+void setup()
+{
+  Serial.begin(9600);
+  pinMode(bass, INPUT);
+  pinMode(hHat, INPUT);
+  pinMode(hTom, INPUT);
+  pinMode(mTom, INPUT);
+  pinMode(ride, INPUT);
+  pinMode(snare, INPUT);
+  pinMode(lTom, INPUT);
+  pinMode(crash, INPUT);
+
+  //  setup serial
+}
+
+void loop()
+{
+  valBass = digitalRead(bass);// read the input pin
+  valRide = digitalRead(hHat);// read the input pin
+  valCrash = digitalRead(hTom);// read the input pin
+  valmTom = digitalRead(mTom);// read the input pin
+  vallTom = digitalRead(ride);// read the input pin
+  valhHat = digitalRead(snare);// read the input pin
+  valSnare = digitalRead(lTom);// read the input pin
+  valhTom = digitalRead(crash);// read the input pin
+
+  if (valBass == 1)//bt5
+  {
+    Keyboard.press('g');
+  }
+  else{
+    Keyboard.release('g');
+  }
+
+  if (valhHat == 1)//bt4
+  {
+    Keyboard.press('f');
+  }
+   else{
+    Keyboard.release('f');
+  }
+
+  if (valhTom == 1)//bt8
+  {
+    Keyboard.press('k');
+  }
+   else{
+    Keyboard.release('k');
+  }
+  if (valmTom == 1)//bt7
+  {
+    Keyboard.press('j');
+  }
+   else{
+    Keyboard.release('j');d
+  }
+
+  if (valRide == 1)//bt3
+  {
+    Keyboard.press('d');
+  }
+   else{
+    Keyboard.release('d');
+  }
+
+  if (valSnare == 1)//bt1
+  {
+    Keyboard.press('a');
+  }
+   else{
+    Keyboard.release('a');
+  }
+
+  if (vallTom == 1)//bt6
+  {
+    Keyboard.press('h');
+  }
+   else{
+    Keyboard.release('h');
+  }
+
+  if (valCrash == 1)//bt2
+  {
+    Keyboard.press('s');
+  }
+   else{
+    Keyboard.release('s');
+  }
+
+  delay(100);
+
+}


Apparently Adruino files need a folder. Make a Dobin folder.

error: pathspec 'Code/Dobin/Dobin.ino' did not match any file(s) known to git

--- Code/Dobin/Dobin.ino
+++ Code/Dobin/Dobin.ino
@@ -0,0 +1,66 @@
+#include <Wire.h>
+#include <Servo.h>
+
+#define SLAVE_ADDRESS 0x04 // Discover real
+
+Servo servo;
+byte values[2] = {0,0};
+byte servoPin = 9;
+byte motorPin = 11;
+int motorlevel = 1;
+
+
+//MOTOR code
+#define pwmA 3
+byte spd = 0;
+ long elapsed = 0;
+
+void setup() {
+
+ Serial.begin(9600);
+ servo.attach(servoPin);
+ servo.write(90);
+ pinMode(motorPin, OUTPUT);
+
+ // initialize i2c as slave
+ Wire.begin(SLAVE_ADDRESS);
+
+ // define callbacks for i2c communication
+ Wire.onReceive(receiveData);
+ Wire.onRequest(sendData);
+ analogWrite(pwmA,spd = 0);
+ delay(3000);
+ analogWrite(pwmA, spd = 255);
+
+}
+
+void loop() {
+  elapsed = millis();
+//  Serial.pri
+  Serial.println(spd);
+    if (elapsed > 5000) {
+      spd = 0;
+      analogWrite(pwmA, spd = 0);
+    }
+}
+
+// callback for received data
+void receiveData(int byteCount){
+
+  if (Wire.available() ) {
+    values[0] = Wire.read();
+    values[1] = 191;
+    Serial.println(values[0]);
+    Serial.println(values[1]);
+
+    servo.write(values[0]);
+    analogWrite(motorPin, values[1]);
+  }
+}
+
+// callback for sending data
+void sendData(){
+  // Kill switch interrupt stuff
+  // if interrupt: Wire.write(1);
+  // else: Wire.write(0);
+}


Avoid heap allocations for some global objects.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/RichoM/Uzi.git/'


First version

First version

error: pathspec 'ESP8266Client.ino' did not match any file(s) known to git

--- ESP8266Client.ino
+++ ESP8266Client.ino
@@ -0,0 +1,19 @@
+//  This is the client code for ESP8266 Arduino Shield by http://www.doit.am/
+//  Set the ESP8266 as STA mode, Socket Type=Client, Transport Type=UDP, Remote IP=(this PC), Remote Port=9000
+//  Switch the dual-port switch to OFF, upload the sketch, then switch to ON.
+
+void setup() {
+  // put your setup code here, to run once:
+  Serial.begin(9600);
+  // initialize digital pin 13 as an output.
+  pinMode(13, OUTPUT);
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+  delay(1000);              // wait for a second
+  Serial.println("hello this is ESP8266Client");
+  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
+  delay(1000);              // wait for a second
+  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
+}


Clock example that used internal RTC of a Teensy 3.0 or Teensy 3.1

error: pathspec 'examples/MatrixClock3/MatrixClock3.ino' did not match any file(s) known to git

--- examples/MatrixClock3/MatrixClock3.ino
+++ examples/MatrixClock3/MatrixClock3.ino
@@ -0,0 +1,252 @@
+/*
+ * This clock example uses the RTC from a Teensy3 (Teensy 3.0 or 3.1).
+ *
+ * RTC clock is set in response to serial port time message
+ * A Processing example sketch to set the time is included in the download
+ * On Linux, you can use "date +T%s > /dev/ttyUSB0" (UTC time zone)
+ *
+ * Or, if a time zone is to be set (and setting TZ doesn't do the trick):
+ *
+ * Example: UTC+2
+ *   date -d "+2 hours" +T%s > /dev/ttyUSB0
+ *
+ * Time code is taken from example TimeTeensy3.ino.
+ *
+ * SmartMatrix Features Demo - Wolfgang Astleitner mrwastl@users.sf.net
+ * This example code is released into the public domain
+ */
+
+#include <Time.h>
+#include <SmartMatrix.h>
+
+//#define DEBUG_SERIAL
+
+rgb24 bgCol        = {0x00, 0x00, 0x00};  // background colour
+
+rgb24 timeCol      = {0x2f, 0x2f, 0xff};  // time: segment colour
+rgb24 timeColFx    = {0x00, 0x00, 0x1f};  // time: colour of 'non active segment' effect
+rgb24 dateCol      = {0x00, 0x00, 0x9f};  // date: segment colour
+rgb24 dateColFx    = {0x00, 0x00, 0x15};  // date: colour of 'non active segment' effect
+
+// values for a 96x64 display; need to be adjusted for other resolutions
+int timeSegT       = 4;  // time: thickness of a segment (in pixel)
+int timeSegW       = 17; // time: length of a single segment (in pixel)
+int dateSegT       = 2;  // date: thickness of a segment
+int dateSegW       = 7;  // date: length of a single segment
+
+const int showSecs = 2;  // display seconds: 0: no, 1: yes, 2: no seconds, but blinking dots
+const int showYear = 0;  // show year: 0 no, 1: yes
+
+
+
+SmartMatrix matrix;
+
+const int timeSegH = timeSegW * 2 - timeSegT;
+const int dateSegH = dateSegW * 2 - dateSegT;
+
+byte currSec = 60;
+
+
+void setup() {
+  // set the Time library to use Teensy 3.x's RTC to keep time
+  setSyncProvider(getTeensy3Time);
+
+  Serial.begin(9600);
+  delay(200);
+  if (timeStatus()!= timeSet) {
+    Serial.println("Unable to sync with the RTC");
+  } else {
+    Serial.println("RTC has set the system time");
+  }
+
+  // setup matrix
+  matrix.begin();
+}
+
+void loop() {
+  time_t t = processSyncMessage();
+  if (t != 0) {
+    Teensy3Clock.set(t); // set the RTC
+    setTime(t);
+  }
+
+  int x;
+  int y;
+
+  int timeW = timeSegW * ((showSecs == 1) ? 6 : 4) + timeSegT * ( (showSecs == 1) ? 9 : 5); // calc. width of time output
+  int dateW = (dateSegW + dateSegT) * ((showYear) ? 10 : 5) + dateSegT; // calc. width of date output
+
+  int tSec = second();
+  int tMin = minute();
+  int tHour = hour();
+  int tYear = year();
+  int tMon = month();
+  int tDay = day();
+
+
+  if (tSec != currSec) {
+    // clear screen before writing new text
+    matrix.fillScreen(bgCol);
+
+    currSec = tSec;
+
+#ifdef DEBUG_SERIAL
+    Serial.print("Ok, Time = ");
+    print2digits(tHour);
+    Serial.write(':');
+    print2digits(tMin);
+    Serial.write(':');
+    print2digits(tSec);
+    Serial.print(", Date (D/M/Y) = ");
+    Serial.print(tDay);
+    Serial.write('/');
+    Serial.print(tMon);
+    Serial.write('/');
+    Serial.print(tYear);
+    Serial.println();
+#endif
+
+    // center time
+    x = ( matrix.getScreenWidth() - timeW ) / 2;
+    y = timeSegT;
+
+    x += drawNumber(x, y, tHour, timeSegW, timeSegT, 2, timeCol, timeColFx);
+    x += timeSegT;
+    if (showSecs != 2 || (tSec % 2) ) {
+      drawBar(x, y + (timeSegT * 2) - 1, timeSegT, timeSegT, 0, timeCol);
+      drawBar(x, y + (timeSegH - (timeSegT * 2)) - 1, timeSegT, timeSegT, 0, timeCol);
+    } else {
+      drawBar(x, y + (timeSegT * 2) - 1, timeSegT, timeSegT, 0, timeColFx);
+      drawBar(x, y + (timeSegH - (timeSegT * 2)) - 1, timeSegT, timeSegT, 0, timeColFx);
+    }
+    x += timeSegT * 2;
+    x += drawNumber(x, y, tMin, timeSegW, timeSegT, 2, timeCol, timeColFx);
+    if (showSecs == 1) {
+      x += timeSegT;
+      drawBar(x, y + (timeSegT * 2) - 1, timeSegT, timeSegT, 0, timeCol);
+      drawBar(x, y + (timeSegH - (timeSegT * 2)) - 1, timeSegT, timeSegT, 0, timeCol);
+      x += timeSegT * 2;
+      x += drawNumber(x, y, tSec, timeSegW, timeSegT, 2, timeCol, timeColFx);
+    }
+    y += timeSegH + timeSegT;
+
+
+    // center date
+    x = (matrix.getScreenWidth() - dateW) / 2;
+    y += (matrix.getScreenHeight() - y - dateSegH) / 2;
+
+    if (showYear) {
+      x += drawNumber(x, y, tYear, dateSegW, dateSegT, 4, dateCol, dateColFx);
+      x += dateSegT;
+      drawBar(x, y + (dateSegH / 2) - 1, dateSegW, dateSegT, 1, dateCol);
+      x += dateSegW + dateSegT;
+      x += drawNumber(x, y, tMon, dateSegW, dateSegT, 2, dateCol, dateColFx);
+      x += dateSegT;
+      drawBar(x, y + (dateSegH / 2) - 1, dateSegW, dateSegT, 1, dateCol);
+      x += dateSegW + dateSegT;
+      x += drawNumber(x, y, tDay, dateSegW, dateSegT, 2, dateCol, dateColFx);
+    } else {
+      x += drawNumber(x, y, tDay, dateSegW, dateSegT, 2, dateCol, dateColFx);
+      x += dateSegT;
+      drawBar(x + (dateSegW - dateSegT) / 2, y + dateSegH - dateSegT, dateSegT, dateSegT, 1, dateCol);
+      x += dateSegW + dateSegT;
+      x += drawNumber(x, y, tMon, dateSegW, dateSegT, 2, dateCol, dateColFx);
+    }
+
+    matrix.swapBuffers();
+  } else {
+    /*delay(1000);*/
+    delay(10);
+  }
+}
+
+
+time_t getTeensy3Time() {
+  return Teensy3Clock.get();
+}
+
+
+/*  code to process time sync messages from the serial port   */
+#define TIME_HEADER  "T"   // Header tag for serial time sync message
+
+unsigned long processSyncMessage() {
+  unsigned long pctime = 0L;
+  const unsigned long DEFAULT_TIME = 1357041600; // Jan 1 2013
+
+  if(Serial.find(TIME_HEADER)) {
+     pctime = Serial.parseInt();
+     return pctime;
+     if( pctime < DEFAULT_TIME) { // check the value is a valid time (greater than Jan 1 2013)
+       pctime = 0L; // return 0 to indicate that the time is not valid
+     }
+  }
+  return pctime;
+}
+
+
+void print2digits(int number) {
+  if (number >= 0 && number < 10) {
+    Serial.write('0');
+  }
+  Serial.print(number);
+}
+
+
+
+/* taken from my library 'serdisplib', testserdisp,c */
+
+void drawBar(int x, int y, int w, int h, int hor, rgb24 col) {
+  int i,j;
+  for (j = y; j < y + ((hor)? h : w); j ++)
+    for (i = x; i < x + ((hor)? w : h); i ++)
+      matrix.drawPixel(i, j, col);
+}
+
+
+void drawDigit(int x, int y, int digit, int segwidth, int thick, rgb24 col, rgb24 colFX) {
+  if (digit < 0 || digit > 9) return;
+
+  // draw 'passive' 8
+  drawBar(x,                    y,                        segwidth, thick, 1, colFX);
+  drawBar(x,                    y + segwidth - thick,     segwidth, thick, 1, colFX);
+  drawBar(x,                    y + 2*(segwidth - thick), segwidth, thick, 1, colFX);
+
+  drawBar(x,                    y,                        segwidth, thick, 0, colFX);
+  drawBar(x + segwidth - thick, y,                        segwidth, thick, 0, colFX);
+  drawBar(x,                    y + segwidth - thick,     segwidth, thick, 0, colFX);
+  drawBar(x + segwidth - thick, y + segwidth - thick,     segwidth, thick, 0, colFX);
+
+  // draw active digit
+  if ( digit != 1 && digit != 4 )
+    drawBar(x,                    y,                        segwidth, thick, 1, col);
+  if ( digit != 1 && digit != 7 && digit != 0 )
+    drawBar(x,                    y + segwidth - thick,     segwidth, thick, 1, col);
+  if ( digit != 1 && digit != 4 && digit != 7 )
+    drawBar(x,                    y + 2*(segwidth - thick), segwidth, thick, 1, col);
+
+  if ( digit != 1 && digit != 2 && digit != 3 && digit != 7 )
+    drawBar(x,                    y,                        segwidth, thick, 0, col);
+  if ( digit != 5 && digit != 6 )
+    drawBar(x + segwidth - thick, y,                        segwidth, thick, 0, col);
+  if ( digit == 2 || digit == 6 || digit == 8 || digit == 0 )
+    drawBar(x,                    y + segwidth - thick,     segwidth, thick, 0, col);
+  if ( digit != 2 )
+    drawBar(x + segwidth - thick, y + segwidth - thick,     segwidth, thick, 0, col);
+}
+
+
+int drawNumber(int x, int y, int number, int segwidth, int thick, int digits, rgb24 col, rgb24 colFX) {
+  int i, posx = x + (segwidth + thick ) * (digits - 1);
+
+  int num = number;
+
+  if (num < 0 || num > 9999) return 0;
+
+  for (i = digits-1; i >= 0; i--) {
+    drawDigit(posx, y, num % 10, segwidth, thick, col, colFX);
+    posx -= segwidth + thick;
+    num /= 10;
+  }
+  return ( segwidth * digits + thick * (digits - 1) );
+}
+


Create mqtt_dragino_2xrele_lcd_20x4_serial_i2c_ver2.ino

error: pathspec 'dragino/mqtt_dragino_2xrele_lcd_20x4_serial_i2c_ver2.ino' did not match any file(s) known to git

--- dragino/mqtt_dragino_2xrele_lcd_20x4_serial_i2c_ver2.ino
+++ dragino/mqtt_dragino_2xrele_lcd_20x4_serial_i2c_ver2.ino
@@ -0,0 +1,126 @@
+#include <Process.h>
+#include <Wire.h>
+#include <LiquidCrystal_I2C.h>
+#include "MQTTclient.h"
+
+unsigned long time;
+#define I2C_ADDR  0x27
+#define En_pin    2
+#define Rw_pin    1
+#define Rs_pin    0
+#define D4_pin    4
+#define D5_pin    5
+#define D6_pin    6
+#define D7_pin    7
+#define BACKLIGHT_PIN   3
+
+int rele1 = 4;
+int rele2 = 6;
+
+#define MQTT_HOST "190.97.168.236"
+char message_buff[100];
+char message_buff2[100];
+char message[256];
+String id_sensor = "prueba12";
+
+LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin,
+                      D4_pin, D5_pin, D6_pin, D7_pin);
+
+void setup() {
+    Serial.begin(9600);
+  Bridge.begin();
+  mqtt.begin(MQTT_HOST, 1883);
+    mqtt.subscribe("/rr/temp", someEvent);
+  lcd.begin (20, 4);
+  pinMode(rele1, OUTPUT);
+  pinMode(rele2, OUTPUT);
+  digitalWrite(rele1, HIGH);
+  digitalWrite(rele2, HIGH);
+
+  // Switch on the backlight
+  lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
+  lcd.setBacklight(HIGH);
+
+  // Position cursor and write some text
+  lcd.home();
+  lcd.setCursor(0,0);
+  lcd.print("RELE 1: OFF");
+  lcd.setCursor(0,1);
+  lcd.print("RELE 2: OFF");
+
+    mqtt.publish("test/dos", "conectado!");
+}
+
+void loop() {
+
+
+
+ int estadorele1 = bitRead(PORTD,4);
+ int estadorele2 = bitRead(PORTD,6);
+
+   if (millis() > (time + 10000)) {
+       time = millis();
+
+
+
+   mqtt.publish("/pryxo/yxusers/lrojas/control/ui98h23d09h2d/rele/1",estadorele1);
+   mqtt.publish("/pryxo/yxusers/lrojas/control/ui98h23d09h2d/rele/2",estadorele2);
+/*lcd.home();
+  lcd.setCursor(0,2);
+  lcd.print("Status RELE 1X:");
+  lcd.setCursor(17,2);
+  lcd.print(estadorele1);
+
+  lcd.setCursor(0,3);
+  lcd.print("Status RELE 2X:");
+  lcd.setCursor(17,3);
+  lcd.print(estadorele2);
+  */
+
+   }
+
+  else {
+  mqtt.monitor();
+  }
+
+}
+
+
+void someEvent(const String& topic, const String& subtopic, const String& message) {
+
+
+
+
+
+  mqtt.publish("test/dos", "Recibido_Control_D1");
+   if (message == "rele10") {
+    digitalWrite(rele1, HIGH);
+    lcd.setCursor(0,0);
+   // lcd.clear();
+    lcd.print("RELE 1: OFF");
+
+  }
+  else if (message == "rele11"){
+    digitalWrite(rele1, LOW);
+       lcd.setCursor(0,0);
+        //lcd.clear();
+    lcd.print("RELE 1:  ON");
+
+  }
+
+ else if (message == "rele20"){
+    digitalWrite(rele2, HIGH);
+lcd.setCursor(0,1);
+           // lcd.clear();
+    lcd.print("RELE 2: OFF");
+
+  }  else if (message == "rele21"){
+    digitalWrite(rele2, LOW);
+    lcd.setCursor(0,1);
+         //   lcd.clear();
+    lcd.print("RELE 2:  ON");
+
+  }
+
+// lcd.setCursor(2,1);
+}