Update pt_remote controlled car2.ino

Update pt_remote controlled car2.ino

error: pathspec 'pt_remote' did not match any file(s) known to git
error: pathspec 'controlled' did not match any file(s) known to git
error: pathspec 'car/pt_remote' did not match any file(s) known to git
error: pathspec 'controlled' did not match any file(s) known to git
error: pathspec 'car2.ino' did not match any file(s) known to git


Update wemos_remote.ino

Update wemos_remote.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/vaskovasilev/webcontrol.git/'


Added runt rover controller code; not tested or debugged.

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

--- Runt_Rover/Runt_Rover.ino
+++ Runt_Rover/Runt_Rover.ino
@@ -0,0 +1,244 @@
+/*
+ * Title: Runt_Rover
+ *
+ * Author: EEJeffMan
+ *
+ * Description: Receives joystick direction data from xbee, and drives runt rover motors.
+ *
+ *    Hardware:
+ *        Controller: Arduino pro mini 3.3V
+ *        Receiver: Xbee series 1 w/xbee explorer regulated
+ *        Motor driver: DROK DC-DC w/dual L298N Motor Driver Module
+ *
+ *    Motor Driver Module output connections to motors:
+ *        OUT1 = back left blk
+ *        OUT2 = back left red
+ *        OUT3 = front left blk
+ *        OUT4 = front left red
+ *        OUT5 = front right blk
+ *        OUT6 = front right red
+ *        OUT7 = rear right blk
+ *        OUT8 = rear right red
+ *
+ *    Arduino I/O:
+ *        D2-9: Digital outputs to IN1-8, Motor Driver Module
+ *        D10: SW serial RX from xbee explorer, 9600 baud 8N1
+ *
+ *    Flow:
+ *        Read xbee data
+ *        Determine desired motor drive
+ *        Update drive to motors
+ *
+ * Status:
+ *
+ */
+
+#include <SoftwareSerial.h>
+
+#define XBEE_COMMAND_STOP           0
+#define XBEE_COMMAND_FORWARD        8
+#define XBEE_COMMAND_FORWARD_LEFT   9
+#define XBEE_COMMAND_FORWARD_RIGHT  10
+#define XBEE_COMMAND_REVERSE        4
+#define XBEE_COMMAND_REVERSE_LEFT   5
+#define XBEE_COMMAND_REVERSE_RIGHT  6
+#define XBEE_COMMAND_TURN_LEFT      1
+#define XBEE_COMMAND_TURN_RIGHT     2
+
+#define FULL_SPEED                  50
+#define TURN_SPEED                  25
+
+#define LEFT_MOTORS                 0
+#define RIGHT_MOTORS                1
+
+#define MOTOR_OFF                   11
+#define MOTOR_FORWARD_FULL          22
+#define MOTOR_FORWARD_TURN          33
+#define MOTOR_REVERSE_FULL          44
+#define MOTOR_REVERSE_TURN          55
+
+SoftwareSerial xbee(10,A4);   //RX, TX
+
+/*
+ * array 0 = left, array 1 = right
+ *
+ * PWM can only be on pins 3, 5, 6, 9, and 10, use all but 10 for PWM:
+ * 2 = front left a
+ * 3 = front left en
+ * 4 = front right a
+ * 5 = front right en
+ * 6 = rear right en
+ * 7 = rear right a
+ * 8 = rear left a
+ * 9 = rear left en
+ * A0 = front left b
+ * A1 = front right b
+ * A2 = rear right b
+ * A3 = rear left b
+ */
+unsigned int front_motor_a[2] = {2, 4};
+unsigned int front_motor_b[2] = {A0, A1};
+unsigned int rear_motor_a[2] = {8, 7};
+unsigned int rear_motor_b[2] = {A3, A2};
+unsigned int front_motor_en[2] = {3, 5};
+unsigned int rear_motor_en[2] = {9, 6};
+
+unsigned int motor_state[2];
+
+void setup() {
+  // put your setup code here, to run once:
+
+  Serial.begin(9600);
+
+  // xbee data input
+  xbee.begin(9600);
+
+  // motor drive outputs
+  pinMode(front_motor_a[LEFT_MOTORS], OUTPUT);
+  pinMode(front_motor_a[RIGHT_MOTORS], OUTPUT);
+  pinMode(front_motor_b[LEFT_MOTORS], OUTPUT);
+  pinMode(front_motor_b[RIGHT_MOTORS], OUTPUT);
+  pinMode(rear_motor_a[LEFT_MOTORS], OUTPUT);
+  pinMode(rear_motor_a[RIGHT_MOTORS], OUTPUT);
+  pinMode(rear_motor_b[LEFT_MOTORS], OUTPUT);
+  pinMode(rear_motor_b[RIGHT_MOTORS], OUTPUT);
+
+  Serial.println("Begin.");
+}
+
+void loop() {
+  // put your main code here, to run repeatedly:
+    unsigned int i;
+    unsigned int xbee_command;
+
+    delay(500);    // TODO: Replace this with something more deterministic, perhaps based on a timer.
+
+    // read xbee data and update motor states
+    xbee_command = xbee.read();
+    Serial.print("Command = ");
+    Serial.println(xbee_command, DEC);
+    switch(xbee_command)
+    {
+      case XBEE_COMMAND_STOP:
+        // stop position: all off
+        motor_state[LEFT_MOTORS] = MOTOR_OFF;
+        motor_state[RIGHT_MOTORS] = MOTOR_OFF;
+      break;
+
+      case XBEE_COMMAND_FORWARD:
+        // forward position: all forward full speed
+        motor_state[LEFT_MOTORS] = MOTOR_FORWARD_FULL;
+        motor_state[RIGHT_MOTORS] = MOTOR_FORWARD_FULL;
+      break;
+
+      case XBEE_COMMAND_FORWARD_LEFT:
+        // forward left: left motors forward turn speed, right motors forward full speed
+        motor_state[LEFT_MOTORS] = MOTOR_FORWARD_TURN;
+        motor_state[RIGHT_MOTORS] = MOTOR_FORWARD_FULL;
+      break;
+
+      case XBEE_COMMAND_FORWARD_RIGHT:
+        // forward right: left motors forward full speed, right motors forward turn speed
+        motor_state[LEFT_MOTORS] = MOTOR_FORWARD_FULL;
+        motor_state[RIGHT_MOTORS] = MOTOR_FORWARD_TURN;
+      break;
+
+      case XBEE_COMMAND_REVERSE:
+        // reverse position: all reverse full speed
+        motor_state[LEFT_MOTORS] = MOTOR_REVERSE_FULL;
+        motor_state[RIGHT_MOTORS] = MOTOR_REVERSE_FULL;
+      break;
+
+      case XBEE_COMMAND_REVERSE_LEFT:
+        // reverse left: left motors reverse turn speed, right motors reverse full speed
+        motor_state[LEFT_MOTORS] = MOTOR_REVERSE_TURN;
+        motor_state[RIGHT_MOTORS] = MOTOR_REVERSE_FULL;
+      break;
+
+      case XBEE_COMMAND_REVERSE_RIGHT:
+        // reverse right: left motors reverse full speed, right motors reverse turn speed
+        motor_state[LEFT_MOTORS] = MOTOR_REVERSE_FULL;
+        motor_state[RIGHT_MOTORS] = MOTOR_REVERSE_TURN;
+      break;
+
+      case XBEE_COMMAND_TURN_LEFT:
+        // turn left position: left motors reverse full speed, right motors forward full speed
+        motor_state[LEFT_MOTORS] = MOTOR_REVERSE_FULL;
+        motor_state[RIGHT_MOTORS] = MOTOR_FORWARD_FULL;
+      break;
+
+      case XBEE_COMMAND_TURN_RIGHT:
+        // turn right position: left motors forward full speed, right motors reverse full speed
+        motor_state[LEFT_MOTORS] = MOTOR_FORWARD_FULL;
+        motor_state[RIGHT_MOTORS] = MOTOR_REVERSE_FULL;
+      break;
+
+      default:
+        // default is stop: all off
+        motor_state[LEFT_MOTORS] = MOTOR_OFF;
+        motor_state[RIGHT_MOTORS] = MOTOR_OFF;
+      break;
+    }
+
+    // read motor states and drive motors
+    for(i = 0; i < 2; i++)
+    {
+      switch(motor_state[i])
+      {
+        // drive motors: forward: a = high, b = low; reverse: a = low, b = high; off: both low
+        case MOTOR_OFF:
+          digitalWrite(front_motor_a[i], LOW);
+          digitalWrite(front_motor_b[i], LOW);
+          digitalWrite(rear_motor_a[i], LOW);
+          digitalWrite(rear_motor_b[i], LOW);
+          analogWrite(front_motor_en[i], 0);
+          analogWrite(rear_motor_en[i], 0);
+        break;
+
+        case MOTOR_FORWARD_FULL:
+          digitalWrite(front_motor_a[i], HIGH);
+          digitalWrite(front_motor_b[i], LOW);
+          digitalWrite(rear_motor_a[i], HIGH);
+          digitalWrite(rear_motor_b[i], LOW);
+          analogWrite(front_motor_en[i], FULL_SPEED);
+          analogWrite(rear_motor_en[i], FULL_SPEED);
+        break;
+
+        case MOTOR_FORWARD_TURN:
+          digitalWrite(front_motor_a[i], HIGH);
+          digitalWrite(front_motor_b[i], LOW);
+          digitalWrite(rear_motor_a[i], HIGH);
+          digitalWrite(rear_motor_b[i], LOW);
+          analogWrite(front_motor_en[i], TURN_SPEED);
+          analogWrite(rear_motor_en[i], TURN_SPEED);
+        break;
+
+        case MOTOR_REVERSE_FULL:
+          digitalWrite(front_motor_a[i], LOW);
+          digitalWrite(front_motor_b[i], HIGH);
+          digitalWrite(rear_motor_a[i], LOW);
+          digitalWrite(rear_motor_b[i], HIGH);
+          analogWrite(front_motor_en[i], FULL_SPEED);
+          analogWrite(rear_motor_en[i], FULL_SPEED);
+        break;
+
+        case MOTOR_REVERSE_TURN:
+          digitalWrite(front_motor_a[i], LOW);
+          digitalWrite(front_motor_b[i], HIGH);
+          digitalWrite(rear_motor_a[i], LOW);
+          digitalWrite(rear_motor_b[i], HIGH);
+          analogWrite(front_motor_en[i], TURN_SPEED);
+          analogWrite(rear_motor_en[i], TURN_SPEED);
+        break;
+
+        default:
+          digitalWrite(front_motor_a[i], LOW);
+          digitalWrite(front_motor_b[i], LOW);
+          digitalWrite(rear_motor_a[i], LOW);
+          digitalWrite(rear_motor_b[i], LOW);
+          analogWrite(front_motor_en[i], 0);
+          analogWrite(rear_motor_en[i], 0);
+        break;
+      }
+    }
+}


Add simple Arduino test program

Add simple Arduino test program

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

--- SimpleTest/SimpleTest.ino
+++ SimpleTest/SimpleTest.ino
@@ -0,0 +1,74 @@
+void setup() {
+  // initialize serial communication at 9600 bits per second:
+  Serial.begin(9600);
+  Keyboard.begin();
+  //setup buttons
+  pinMode(2, INPUT_PULLUP); //Button 1
+  pinMode(3, INPUT_PULLUP); //Button 2
+  pinMode(4, INPUT_PULLUP); //Button 3
+  pinMode(5, INPUT_PULLUP); //Button 4
+  //setup mainboard connection
+  pinMode(6, OUTPUT); //Reset pin
+  digitalWrite(6, LOW); //active high pulse
+  pinMode(7, OUTPUT); //Power on pin
+  digitalWrite(7, LOW); //active high pulse
+  //setup coin detector
+  pinMode(8, INPUT_PULLUP); //Coin 1
+  pinMode(9, INPUT_PULLUP); //Coin 2
+  pinMode(10, INPUT_PULLUP); //Coin 3
+  pinMode(11, INPUT_PULLUP); //Reject button
+  pinMode(12, OUTPUT); //Accept all coins
+  digitalWrite(12, LOW);
+}
+
+void loop() {
+  // read the input pin:
+  int buttonState2 = digitalRead(2);
+  int buttonState3 = digitalRead(3);
+  int buttonState4 = digitalRead(4);
+  int buttonState5 = digitalRead(5);
+  int buttonState8 = digitalRead(8);
+  int buttonState9 = digitalRead(9);
+  int buttonState10 = digitalRead(10);
+  int buttonState11 = digitalRead(11);
+  // print out the state of the buttons:
+  Serial.print(buttonState2);
+  Serial.print(buttonState3);
+  Serial.print(buttonState4);
+  Serial.print(buttonState5);
+  Serial.print(buttonState8);
+  Serial.print(buttonState9);
+  Serial.print(buttonState10);
+  Serial.print(buttonState11);
+  Serial.print('\n');
+  delay(25);        // delay in between reads for stability
+  if(buttonState2 == LOW) {
+    Keyboard.write('A');
+    digitalWrite(6, HIGH); //push reset
+  }
+  else {
+    digitalWrite(6, LOW);
+  }
+  if(buttonState3 == LOW) {
+    Keyboard.write('B');
+    digitalWrite(7, HIGH); //push power
+  }
+  else {
+    digitalWrite(7, LOW);
+  }
+  if(buttonState4 == LOW) {
+    Keyboard.write('C');
+  }
+  if(buttonState5 == LOW) {
+    Keyboard.write('D');
+  }
+  if(buttonState8 == LOW) {
+    Keyboard.write('1');
+  }
+  if(buttonState9 == LOW) {
+    Keyboard.write('2');
+  }
+  if(buttonState10 == LOW) {
+    Keyboard.write('3');
+  }
+}


Added code to control one BLDC to the motion sensor board test 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/ocean-x/erikson-1.git/'


library test

library test

error: pathspec 'testing/arduino/self-driving-lib.ino' did not match any file(s) known to git

--- testing/arduino/self-driving-lib.ino
+++ testing/arduino/self-driving-lib.ino
@@ -0,0 +1,120 @@
+#include "Arduino.h"
+#include "NewPing.h"
+
+// defines pins numbers
+const uint8_t trigPin = 9;
+const uint8_t echoPin = 10;
+const uint8_t maxSenstorDistance = 200; // cm
+
+const uint8_t motorPin1_1 = 4;
+const uint8_t motorPin1_2 = 5;
+const uint8_t motorPin1_speed = 3;
+const uint8_t motorPin1_A = A7;
+
+const uint8_t motorPin2_1 = 7;
+const uint8_t motorPin2_2 = 8;
+const uint8_t motorPin2_speed = 6;
+const uint8_t motorPin2_A = A6;
+
+/*
+const uint8_t motorPin3_1 = 10;
+const uint8_t motorPin3_2 = 11;
+const uint8_t motorPin3_speed = 9;
+const uint8_t motorPin3_A = A5;
+*/
+
+const uint8_t rangeLimit = 15;
+
+bool spinCompleted = true;
+uint8_t nullResultCount = 0;
+
+NewPing sensor1(trigPin, echoPin, maxSenstorDistance);
+
+
+void setup()
+{
+    // Motor
+    pinMode(motorPin1_1, OUTPUT);
+    pinMode(motorPin1_2, OUTPUT);
+    pinMode(motorPin1_speed, OUTPUT);
+    pinMode(motorPin1_A, INPUT);
+
+    pinMode(motorPin2_1, OUTPUT);
+    pinMode(motorPin2_2, OUTPUT);
+    pinMode(motorPin2_speed, OUTPUT);
+    pinMode(motorPin2_A, INPUT);
+
+    /*
+    pinMode(motorPin3_1, OUTPUT);
+    pinMode(motorPin3_2, OUTPUT);
+    pinMode(motorPin3_speed, OUTPUT);
+    pinMode(motorPin3_A, INPUT);
+	*/
+
+    Serial.begin(9600); // Starts the serial communication
+}
+
+
+void SetMotor(int pinSpeed, int pin1, int pin2, int speed)
+{
+    analogWrite(pinSpeed, abs(speed));
+    if (speed < 0)
+    {
+        analogWrite(pin1, 0);
+        analogWrite(pin2, 255);
+    }
+    else
+    {
+        analogWrite(pin1, 255);
+        analogWrite(pin2, 0);
+    }
+
+    if (speed == 0)
+    {
+        analogWrite(pin1, 0);
+        analogWrite(pin2, 0);
+    }
+}
+
+
+void loop()
+{
+	long range = sensor1.ping_cm()
+	if (range == 0)
+	{
+		nullResultCount++;
+		if(nullResultCount < 10)
+		{
+			delay(30);
+			return;
+		}
+	}
+
+	// obstacle is further away than X cm
+	if(spinCompleted && range > 0 && range > rangeLimit)
+	{
+		nullResultCount = 0;
+
+		// drive
+	    SetMotor(motorPin1_speed, motorPin1_1, motorPin1_2, 255);
+	    SetMotor(motorPin2_speed, motorPin2_1, motorPin2_2, 255);
+    	//SetMotor(motorPin3_speed, motorPin3_1, motorPin3_2, 0);
+	}
+	else
+	{
+		spinCompleted = false;
+
+		// rotate
+	    SetMotor(motorPin1_speed, motorPin1_1, motorPin1_2, 255);
+    	SetMotor(motorPin2_speed, motorPin2_1, motorPin2_2, 0);
+    	//SetMotor(motorPin3_speed, motorPin3_1, motorPin3_2, 0);
+
+    	if(range > (rangeLimit * 2))
+    	{
+    		spinCompleted = true;
+    	}
+	}
+
+	delay(50);  // 29ms should be min between scans
+}
+


Added Button ADC Tester

Added Button ADC Tester

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/Duke-Medical-Instrumentation/InceptionTI.git/'


Add MT9M034 RAW catpure example

Add MT9M034 RAW catpure example

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

--- ArduCAM/examples/Shield_V2/ArduCAM_Shield_V2_MT9M034_Camera_RAW/ArduCAM_Shield_V2_MT9M034_Camera_RAW.ino
+++ ArduCAM/examples/Shield_V2/ArduCAM_Shield_V2_MT9M034_Camera_RAW/ArduCAM_Shield_V2_MT9M034_Camera_RAW.ino
@@ -0,0 +1,128 @@
+// ArduCAM demo (C)2018 Lee
+// Web: http://www.ArduCAM.com
+// This program is a demo of how to use most of the functions
+// of the library with a supported camera modules.
+// This demo was made for MT9M034 sensor.
+// It will turn the ArduCAM into a real digital camera with capture and playback functions.
+// 1.Continuous shooting and store the image to Micro SD/TF card with RAW format.
+//IF the FRAMES_NUM is 0X00, take one photos
+//IF the FRAMES_NUM is 0X01, take two photos
+//IF the FRAMES_NUM is 0X02, take three photos
+//IF the FRAMES_NUM is 0X03, take four photos
+//IF the FRAMES_NUM is 0X04, take five photos
+//IF the FRAMES_NUM is 0X05, take six photos
+//IF the FRAMES_NUM is 0X06, take seven photos
+//IF the FRAMES_NUM is 0X07, continue shooting until the FIFO is full
+// This program requires the ArduCAM V4.0.0 (or above) library and ArduCAM shield V2
+// and use Arduino IDE 1.6.8 compiler or above
+
+#define   FRAMES_NUM    0x07
+#include <SD.h>
+#include <Wire.h>
+#include <ArduCAM.h>
+#include <SPI.h>
+
+#if !(defined (MT9M034_CAM))
+#error This demo can only support  MT9M034_CAM.
+#endif
+#if !(defined ARDUCAM_SHIELD_V2 && defined MT9M034_CAM )
+#error Please select the hardware platform and camera module in the ../libraries/ArduCAM/memorysaver.h file
+#endif
+
+#define SD_CS 9
+const int SPI_CS = 10;
+
+ArduCAM myCAM(MT9M034, SPI_CS);
+uint32_t length = 0;
+char str[8];
+void setup()
+{
+  uint16_t vid;
+  uint8_t temp = 0;
+  Wire.begin();
+  Serial.begin(115200);
+  Serial.println(F("ArduCAM Start!"));
+  // set the SPI_CS as an output:
+  pinMode(SPI_CS, OUTPUT);
+  // initialize SPI:
+  SPI.begin();
+  while (1) {
+    //Check if the ArduCAM SPI bus is OK
+    myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
+    temp = myCAM.read_reg(ARDUCHIP_TEST1);
+    if (temp != 0x55) {
+      Serial.println(F("SPI interface Error!"));
+      delay(1000); continue;
+    } else {
+      Serial.println(F("SPI interface OK!")); break;
+    }
+  }
+  myCAM.InitCAM();
+  myCAM.write_reg(ARDUCHIP_FRAMES, FRAMES_NUM);
+  //Initialize SD Card
+  while (!SD.begin(SD_CS)) {
+    Serial.println(F("SD Card Error")); delay(1000);
+  }
+  Serial.println(F("SD Card detected!"));
+}
+void loop()
+{
+  GrabImage(str);
+}
+void GrabImage(char* str)
+{
+  File outFile;
+  char VL;
+  byte buf[256];
+  static int k = 0;
+  //Flush the FIFO
+  myCAM.flush_fifo();
+  //Start capture
+  myCAM.start_capture();
+  Serial.println(F("Start Capture"));
+  //Polling the capture done flag
+  while (!myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK));
+  length = myCAM.read_fifo_length();
+  Serial.print(F("The fifo length is :"));
+  Serial.println(length, DEC);
+  int PIC_CNT = length / 1233920; //1233920 = 1280*960
+  Serial.println(PIC_CNT, DEC);
+  Serial.println(F("Capture Done."));
+  while (PIC_CNT--) {
+    k = k + 1;
+    itoa(k, str, 10);
+    strcat(str, ".raw");      //Generate file name
+    static int k = 0;
+    int i, j = 0;
+    outFile = SD.open(str, O_WRITE | O_CREAT | O_TRUNC);
+    if (! outFile)
+    {
+      Serial.println(F("File open error"));
+      return;
+    }
+    Serial.println("Writting the image data in RAW format...");
+    k = 0;
+    //Read 1280x960 byte from FIFO
+    //Save as RAW format
+    for (i = 0; i < 1280; i++)
+      for (j = 0; j < 964; j++)
+      {
+        VL = myCAM.read_fifo();
+        buf[k++] = VL;
+        //Write image data to bufer if not full
+        if (k >= 256)
+        {
+          //Write 256 bytes image data to file from buffer
+          outFile.write(buf, 256);
+          k = 0;
+        }
+      }
+    //Close the file
+    outFile.close();
+  }
+  //Clear the capture done flag
+  myCAM.clear_fifo_flag();
+  Serial.println("Image save OK!");
+  return;
+}
+


add arduino code

add arduino code

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

--- arduino/main/main.ino
+++ arduino/main/main.ino
@@ -0,0 +1,101 @@
+// set pin numbers:
+const int button1Pin = 2;     // the number of the pushbutton pin
+const int button2Pin = 7;
+const int button3Pin = 12;
+const int button4Pin = 13;
+
+const int led1Pin =  4;       // the number of the LED pin
+const int led2Pin =  8;
+const int led3Pin =  10;
+const int led4Pin =  11;
+
+bool button1Active = true;
+int button1State = 0;         // variable for reading the pushbutton status
+
+bool button2Active = true;
+int button2State = 0;
+
+bool button3Active = true;
+int button3State = 0;
+
+bool button4Active = true;
+int button4State = 0;
+
+String writeBuffer;
+String readBuffer;
+
+void setup() {
+  // initialize the LED pin as an output:
+  pinMode(led1Pin, OUTPUT);
+  pinMode(led2Pin, OUTPUT);
+  // initialize the pushbutton pin as an input:
+  pinMode(button1Pin, INPUT);
+  pinMode(button2Pin, INPUT);
+  // initialize serial communication:
+  Serial.begin(9600);
+}
+
+void serialEvent() {
+  readBuffer = Serial.readString();
+  Serial.println("------------");
+  Serial.println(readBuffer);
+  Serial.println("------------");
+  if (readBuffer.length() == 4) {
+    button1Active = readBuffer.charAt(0) == '0' ? false : true;
+    button2Active = readBuffer.charAt(1) == '0' ? false : true;
+    button3Active = readBuffer.charAt(2) == '0' ? false : true;
+    button4Active = readBuffer.charAt(3) == '0' ? false : true;
+  }
+}
+
+void loop() {
+  // read the state of the pushbutton value:
+  button1State = digitalRead(button1Pin);
+  button2State = digitalRead(button2Pin);
+  button3State = digitalRead(button3Pin);
+  button4State = digitalRead(button4Pin);
+
+
+  if (button1Active == true) {
+    // check if the pushbutton is pressed.
+    // if it is, the buttonState is HIGH:
+    if (button1State == HIGH) {
+      // turn LED on:
+      digitalWrite(led1Pin, HIGH);
+    } else {
+      // turn LED off:
+      digitalWrite(led1Pin, LOW);
+    }
+  }
+
+  if (button2Active == true) {
+    if (button2State == HIGH) {
+      digitalWrite(led2Pin, HIGH);
+    } else {
+      digitalWrite(led2Pin, LOW);
+    }
+  }
+
+  if (button3Active == true) {
+    if (button3State == HIGH) {
+      digitalWrite(led3Pin, HIGH);
+    } else {
+      digitalWrite(led3Pin, LOW);
+    }
+  }
+
+  if (button4Active == true) {
+    if (button4State == HIGH) {
+      digitalWrite(led4Pin, HIGH);
+    } else {
+      digitalWrite(led4Pin, LOW);
+    }
+  }
+
+  // send button status
+  writeBuffer = String(button1Active) + String(button1State)
+                + String(button2Active) + String(button2State)
+                + String(button3Active) + String(button3State)
+                + String(button4Active) + String(button4State);
+  Serial.println(writeBuffer);
+}


second

second

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

--- pin_78.ino
+++ pin_78.ino
@@ -0,0 +1,15 @@
+  void setup() {
+  pinMode(8, OUTPUT);
+  pinMode(7, OUTPUT);
+}
+
+  void loop() {
+  digitalWrite(8, HIGH);
+  delay(1000);
+  digitalWrite(7, HIGH);
+  delay(1000);
+  digitalWrite(8, LOW);
+  delay(1000);
+  digitalWrite(7, LOW);
+  delay(1000);
+ }


Build test sketch

Build test sketch

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

--- tests/BlynkBuildTest/BlynkBuildTest.ino
+++ tests/BlynkBuildTest/BlynkBuildTest.ino
@@ -0,0 +1,100 @@
+/**************************************************************
+ * This is just a test of Blynk library build in Arduino IDE
+ *
+ *         You should NOT flash this program
+ *         to your hardware or try to run it.
+ *
+ **************************************************************/
+
+#if defined(ARDUINO_AVR_GEMMA) \
+    || defined(ARDUINO_attiny)
+
+  #define BLYNK_NO_INFO
+  #define BLYNK_NO_BUILTIN
+
+  #define SKIP_WRITES_TEST
+
+#endif
+
+#include <BlynkSimpleUserDefined.h>
+
+char auth[] = "12345678901234567890123456789012";
+
+volatile uint8_t test;
+
+// This function is used by Blynk to receive data
+size_t BlynkStreamRead(void* buf, size_t len)
+{
+  uint8_t* byte_buff = (uint8_t*)buf;
+  size_t res = len;
+  while (len--) {
+    *byte_buff++ = test;
+  }
+  return res;
+}
+
+// This function is used by Blynk to send data
+size_t BlynkStreamWrite(const void* buf, size_t len)
+{
+  uint8_t* byte_buff = (uint8_t*)buf;
+  size_t res = len;
+  while (len--) {
+    test = *byte_buff++;
+  }
+  return res;
+}
+
+void setup()
+{
+  Blynk.begin(auth);
+  Blynk.connect();
+}
+
+BLYNK_WRITE(V3)
+{
+  test = param.asInt();
+}
+
+BLYNK_READ(V4)
+{
+  Blynk.virtualWrite(V10, millis(), BlynkFreeRam());
+
+  Blynk.virtualWrite(V10, 1,   1U);
+  Blynk.virtualWrite(V10, 1L,  1UL);
+  Blynk.virtualWrite(V10, 1LL, 1ULL);
+
+#ifndef SKIP_WRITES_TEST
+
+  Blynk.virtualWrite(V10,  (int8_t)1,  (uint8_t)1);
+  Blynk.virtualWrite(V10, (int16_t)1, (uint16_t)1);
+  Blynk.virtualWrite(V10, (int32_t)1, (uint32_t)1);
+  //Blynk.virtualWrite(V10, (int64_t)1, (uint64_t)1);
+
+  Blynk.virtualWrite(V10, (size_t)1);
+
+  Blynk.virtualWrite(V10, (float)1.0F);
+  Blynk.virtualWrite(V10, (double)1.0);
+
+  Blynk.virtualWrite(V10, String("Some string as String)"));
+  Blynk.virtualWrite(V10, "Some string from RAM");
+
+  Blynk.virtualWrite(V10, BLYNK_F("Some string from Flash"));
+
+  BlynkParamAllocated param(128);
+  Blynk.virtualWrite(V10, param);
+
+  Blynk.virtualWriteBinary(V10, "buffer", 6);
+
+#endif
+
+}
+
+void loop()
+{
+  bool hasIncomingData = (test > 0);
+
+  if (!Blynk.run(hasIncomingData)) {
+
+  }
+}
+


Add user button input to 7segment

Add user button input to 7segment

Remove infinite loop through numbers. Accept user button input to display next number

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/prpplague/Userspace-Arduino.git/'


Add button example

Add button example

error: pathspec 'Arduino' did not match any file(s) known to git
error: pathspec 'Libraries/KBOT/examples/Button/Button.ino' did not match any file(s) known to git


src: start to rough in mqtt LED control

src: start to rough in mqtt LED control

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

--- MqttLEDs/MqttLEDs.ino
+++ MqttLEDs/MqttLEDs.ino
@@ -0,0 +1,123 @@
+// Copyright 2016-2017 the project authors as listed in the AUTHORS file.
+// All rights reserved. Use of this source code is governed by the
+// license that can be found in the LICENSE file.
+#include <ESP8266WiFi.h>
+#include <PubSubClient.h>
+#include <Wire.h>
+#include <Adafruit_NeoPixel.h>
+
+// device specifics
+#include "WirelessConfig.h"
+
+#define LED_PIN D6
+#define LED_TOPIC "house/led"
+
+WiFiClient wclient;
+ESP8266WiFiGenericClass wifi;
+
+const char* OFF = "off";
+const char* RANGE = "range";
+
+Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, LED_PIN, NEO_GRB + NEO_KHZ800);
+
+void callback(char* topic, uint8_t* message, unsigned int length) {
+  std::string messageBuffer((const char*) message, length);
+  Serial.println(messageBuffer.c_str());
+
+  if (0 == strcmp(messageBuffer.c_str(), OFF)) {
+    for(uint16_t i=0; i <strip.numPixels(); i++) {
+      strip.setPixelColor(i, strip.Color(0,0,0));
+    }
+  } else if (0 == strncmp(RANGE, messageBuffer.c_str(), strlen(RANGE))) {
+    char* next = strtok((char*) messageBuffer.c_str()," ");
+    next = strtok(nullptr," ");
+    int start = atoi(next);
+    next = strtok(nullptr," ");
+    int end = atoi(next);
+    next = strtok(nullptr," ");
+    int R = atoi(next);
+    next = strtok(nullptr," ");
+    int G = atoi(next);
+    next = strtok(nullptr," ");
+    int B = atoi(next);
+    if ((start < 0)  ||
+        (start >= strip.numPixels()) ||
+        (end >= strip.numPixels()) ||
+        (end < 0) ||
+        (end >= strip.numPixels()) ||
+        (end < 0) ||
+        (R > 255) ||
+        (R < 0) ||
+        (G > 255) ||
+        (G < 0) ||
+        (B > 255) ||
+        (B < 0)) {
+      Serial.println("Message Invalid");
+      return;
+    }
+
+    end = end + 1;
+    for(uint16_t i = start; i < end; i++) {
+      strip.setPixelColor(i, strip.Color(R, G, B));
+    }
+  } else {
+    Serial.println("Message Invalid");
+    return;
+  }
+
+  strip.show();
+};
+
+PubSubClient client(mqttServerString, mqttServerPort, callback, wclient);
+
+void setup() {
+  strip.begin();
+  for(uint16_t i=0; i <strip.numPixels(); i++) {
+    strip.setPixelColor(i, strip.Color(0,0,0));
+  }
+  strip.show(); // Initialize all pixels to 'off'
+
+  Serial.begin(115200);
+  Serial.println("starting");
+
+  // turn of the Access Point as we are not using it
+  wifi.mode(WIFI_STA);
+
+  WiFi.begin(ssid, pass);
+  if (WiFi.waitForConnectResult() == WL_CONNECTED) {
+    Serial.println("WiFi connected");
+  }
+}
+
+int count = 0;
+
+void loop() {
+  client.loop();
+
+  // make sure we are good for wifi
+  if (WiFi.status() != WL_CONNECTED) {
+    Serial.print("Connecting to ");
+    Serial.println(ssid);
+    WiFi.reconnect();
+
+    if (WiFi.waitForConnectResult() != WL_CONNECTED) {
+      Serial.println("Failed to reconnect WIFI");
+      Serial.println(WiFi.waitForConnectResult());
+      delay(100);
+      return;
+    }
+    Serial.println("WiFi connected");
+  }
+
+  if (!client.connected()) {
+    Serial.println("PubSub not connected");
+    if (client.connect("irclient")) {
+      Serial.println("PubSub connected");
+      client.subscribe(LED_TOPIC);
+    } else {
+      Serial.println("PubSub failed to connect");
+    }
+  }
+
+  delay(100);
+}


Initial commit

Initial commit


Added Motor Code

Added Motor Code

3 axis multi-axis support
note: joysticks are meant to be mounted at 45 degree angle in control
box

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

--- Motors_Prototype/Motors_Prototype.ino
+++ Motors_Prototype/Motors_Prototype.ino
@@ -0,0 +1,150 @@
+/*
+  Receiving Motor Code
+  Attempt 1 of mutliaxis support in order to make JP happy
+
+  Written for the Sea Sweepers ROV Club
+  Michael Georgariou 2016
+*/
+
+#include <Servo.h>
+Servo H1;
+Servo H2;
+Servo H3;
+Servo H4;
+Servo V1;
+Servo V2;
+Servo V3;
+Servo V4;
+
+int Joystick1A; //vertical
+  int 1AMap;
+int Joystick1B;
+  int 1BMap;
+int Joystick1C;
+  int 1CMap;
+int Joystick2A; //horizontal
+  int 2AMap;
+int Joystick2B;
+  int 2BMap;
+int Joystick2C;
+  int 2CMap;
+
+int Crab;
+int Pitch;
+
+void setup() {
+
+  H1.attach(2); // left front
+  H2.attach(3); // right front
+  H3.attach(4); // right back
+  H4.attach(5); // left back
+  V1.attach(6);
+  V2.attach(7);
+  V3.attach(8);
+  V4.attach(9);
+}
+
+void loop() {
+  1AMap = map(Joystick1A, 0, 1023, 1100, 1900);
+  1BMap = map(Joystick1B, 0, 1023, 1100, 1900);
+  1CMap = map(Joystick1C, 0, 1023, 1100, 1900);
+  2AMap = map(Joystick2A, 0, 1023, 1100, 1900);
+  2BMap = map(Joystick2B, 0, 1023, 1100, 1900);
+  2CMap = map(Joystick2C, 0, 1023, 1100, 1900);
+
+
+  if ((2CMap < 1600) && (2CMap > 1400)) { //if 2CMap is neutral
+    H2.write(2AMap);
+    H3.write(2AMap);
+    H1.write(2BMap);
+    H4.write(2BMap);
+  }
+
+  if (2CMap > 1600) {
+    Crab = map(2CMap, 1600, 1900, 0, 400);
+    if ((2AMap - Crab) > 1100){
+      H2.write(2AMap + Crab);
+      H3.write(2AMap + Crab);
+    }
+    else {
+      H2.write(2AMap);
+      H3.write(2AMap);
+    }
+    if ((2BMap + Crab) < 1900) {
+      H1.write(2BMap - Crab);
+      H4.write(2BMap - Crab);
+    }
+    else {
+      H1.write(2BMap);
+      H4.write(2BMap);
+    }
+  }
+
+  if (2CMap < 1400) {
+    Crab = map(2CMap, 1400, 1100, 0, 400);
+    if ((2AMap - Crab) > 1100){
+      H2.write(2AMap - Crab);
+      H3.write(2AMap - Crab);
+    }
+    else {
+      H2.write(2AMap);
+      H3.write(2AMap);
+    }
+    if ((2BMap + Crab) < 1900) {
+      H1.write(2BMap + Crab);
+      H4.write(2BMap + Crab);
+    }
+    else {
+      H1.write(2BMap);
+      H4.write(2BMap);
+    }
+  }
+
+
+  if ((1CMap < 1600) && (1CMap > 1400)) { //if 2CMap is neutral
+    V2.write(1AMap);
+    V3.write(1AMap);
+    V1.write(1BMap);
+    V4.write(1BMap);
+  }
+  if (1CMap > 1600) {
+    Pitch = map(1CMap, 1600, 1900, 0, 400);
+    if ((2AMap + Pitch) < 1900){
+      H1.write(2AMap + Pitch);
+      H2.write(2AMap + Pitch);
+    }
+    else {
+      H1.write(2AMap);
+      H2.write(2AMap);
+    }
+    if ((2BMap - Pitch) > 1100) {
+      H3.write(2BMap - Pitch);
+      H4.write(2BMap - Pitch);
+    }
+    else {
+      H3.write(2BMap);
+      H4.write(2BMap);
+    }
+  }
+
+  if (2CMap < 1400) {
+    Pitch = map(2CMap, 1400, 1100, 0, 400);
+    if ((2AMap - Pitch) > 1100){
+      H1.write(2AMap - Pitch);
+      H2.write(2AMap - Pitch);
+    }
+    else {
+      H1.write(2AMap);
+      H2.write(2AMap);
+    }
+    if ((2BMap + Pitch) < 1900) {
+      H3.write(2BMap + Pitch);
+      H4.write(2BMap + Pitch);
+    }
+    else {
+      H3.write(2BMap);
+      H4.write(2BMap);
+    }
+  }
+}
+


Base code

Base code

Uses simple random number to randomly fade the colour red in and out. Need to compartmentalize the mechanism into a function and add green and blue.

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

--- sketch.ino
+++ sketch.ino
@@ -0,0 +1,88 @@
+// Salt Lamp neopixel lights random colour crossfade
+// By Chris Barrett - Polaris Interplanetary - Special Projects Division
+
+#include <Adafruit_NeoPixel.h>
+#include <avr/power.h>
+
+// Which pin on the Arduino is connected to the NeoPixels?
+// On a Trinket or Gemma we suggest changing this to 1
+#define PIN            6
+
+// How many NeoPixels are attached to the Arduino?
+#define NUMPIXELS      133
+#define LOWPIXELS      87
+
+// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
+// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
+// example for more information on possible values.
+Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
+
+int delayval = 500; // delay for half a second
+int potVal = 9;                                     //integer to store the value from the potentiometer
+int potPin = 2;                                     //integer to store the potentiometer pin
+int rcount;                                         // Counter for red
+int gcount;                                         // Counter for green
+int bcount;                                         // Counter for blue
+int rval;                                           //int stores red brightness
+int gval;                                           //int stores green brightness
+int bval;                                           //int stores blue brightness
+int rgo;                                            // red go int, 0 for off, 1 for upwards, 2 for downwards
+int ggo;                                            // green go int, 0 for off, 1 for upwards, 2 for downwards
+int bgo;                                            // blue go int, 0 for off, 1 for upwards, 2 for downwards
+int magicnumber;                                    // magic number determines when to fire colours
+
+void setup() {
+
+Serial.begin(9600);
+  pixels.begin();                                   // This initializes the NeoPixel library.
+}
+
+void loop() {
+
+magicnumber = random(0,3);                          //creates a magic number
+
+if (magicnumber == 1 && rgo == 0){                  //checks to see if magic number has selected red and red is not currently firing
+  rgo = 1;                                          //sets the red go bit to 1 meaning positive alternation
+}
+
+if (magicnumber == 2 && ggo == 0){                   //checks to see if magic number has selected green
+  ggo = 1;
+}
+
+if (magicnumber == 1 && bgo == 0){                   //checks to see if magic number has selected blue
+  bgo = 1;
+}
+
+if (rgo == 1){                                      //checks for ascent stage bit, adds one to red brightness
+  rval = rval + 1;
+}
+
+if (rgo == 2){
+  rval = rval - 1;
+}
+
+if (rval >= 255){
+  rgo == 2;
+}
+
+if (rval == 0 && rgo == 2){
+  rgo = 0;
+  rval = 0;
+}
+
+potVal = analogRead(potPin);                     //determine delay
+potVal = map(potVal, 0, 1024, 0, 500);
+
+
+for(int i=LOWPIXELS;i<NUMPIXELS;i++){
+    pixels.setPixelColor(i, pixels.Color(rval,bval,gval));
+}
+
+
+pixels.show(); // This sends the updated pixel color to the hardware.
+
+Serial.println(rval);
+
+
+delay(potVal);
+}


MQ7 rewritten, interrupt only, 4s interval

see worklong in Google Drive for details

error: pathspec 'Individual' did not match any file(s) known to git
error: pathspec 'sensor' did not match any file(s) known to git
error: pathspec 'rewritten/MQ7.ino' did not match any file(s) known to git


Fixed encoder demo index functionality. Needs its own interrupt.

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


Create RedBear_Duo_BLE.ino

Create RedBear_Duo_BLE.ino

error: pathspec 'firmware/examples/01_Particle/RedBear_Duo_BLE.ino' did not match any file(s) known to git

--- firmware/examples/01_Particle/RedBear_Duo_BLE.ino
+++ firmware/examples/01_Particle/RedBear_Duo_BLE.ino
@@ -0,0 +1,66 @@
+/**************************************************************
+ * Blynk is a platform with iOS and Android apps to control
+ * Arduino, Raspberry Pi and the likes over the Internet.
+ * You can easily build graphic interfaces for all your
+ * projects by simply dragging and dropping widgets.
+ *
+ *   Downloads, docs, tutorials: http://www.blynk.cc
+ *   Blynk community:            http://community.blynk.cc
+ *   Social networks:            http://www.fb.com/blynkapp
+ *                               http://twitter.com/blynk_app
+ *
+ * Blynk library is licensed under MIT license
+ * This example code is in public domain.
+ *
+ **************************************************************
+ *
+ * This example shows how to use RedBear Duo BLE
+ * to connect your project to Blynk.
+ *
+ * NOTE: BLE support is in beta!
+ *
+ **************************************************************/
+
+#if defined(ARDUINO)
+  SYSTEM_MODE(MANUAL);    // If Arduino - do not connect to Particle cloud
+#else
+  SYSTEM_MODE(AUTOMATIC); // Otherwise, connect to Particle cloud
+#endif
+
+//#define BLYNK_DEBUG
+#define BLYNK_PRINT Serial
+
+//#define BLYNK_USE_DIRECT_CONNECT
+
+#include <BlynkSimpleRedBear_Duo_BLE.h>
+
+// You should get Auth Token in the Blynk App.
+// Go to the Project Settings (nut icon).
+char auth[] = "YourAuthToken";
+
+void setup() {
+  Serial.begin(9600);
+  delay(5000);
+
+  Blynk.begin(auth);
+
+  Serial.println("Waiting for connections...");
+}
+
+void loop() {
+  Blynk.run();
+}
+
+// Next functions are optional.
+// Add ZeRGBa Widget on V0 to control onboard LED.
+BLYNK_CONNECTED() {
+  RGB.control(true);
+}
+
+BLYNK_WRITE(V0) {
+  int r = param[0].asInt();
+  int g = param[1].asInt();
+  int b = param[2].asInt();
+  RGB.color(r, g, b);
+}
+


Arduino - LED brightness.

Arduino - LED brightness.

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

--- arduino/006_led_brightness/006_led_brightness.ino
+++ arduino/006_led_brightness/006_led_brightness.ino
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2020, Łukasz Marcin Podkalicki <lpodkalicki@gmail.com>
+ * Arduino/006
+ * Blinking LED with BasicLED class.
+ */
+
+#include <stdint.h>
+
+/**
+ * The instance of this class can control single LED.
+ * - on, off, toggle (any digital pin)
+ * - brightness (only PWM pins; i.e. for Arduino Uno: 3, 5, 6, 9, 10, 11)
+ */
+class BasicLed {
+public:
+  BasicLed(uint8_t pin): pin_(pin) {
+    pinMode(pin, OUTPUT);
+  }
+  /**
+   * Light the LED up
+   */
+  void on(void) {
+    digitalWrite(pin_, HIGH);
+  }
+  /**
+   * Turn the LED off
+   */
+  void off(void) {
+    digitalWrite(pin_, LOW);
+  }
+  /**
+   * Toogle LED on/off
+   */
+  void toggle(void) {
+    digitalWrite(pin_, !digitalRead(pin_));
+  }
+  /**
+   * Set LED brightness from range <0, 255>
+   */
+  void setBrightness(uint8_t value) {
+    analogWrite(pin_, value);
+  }
+private:
+  uint8_t pin_;
+}; /* End of class BasicLed */
+
+BasicLed led(11);
+
+void setup() {
+  // do nothing
+}
+
+void loop() {
+    led.setBrightness(10); // 10/255 ~= 4%
+}
+


4D display working

4D display working

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

--- 4DSystemDispalyBare/4DSystemDispalyBare.ino
+++ 4DSystemDispalyBare/4DSystemDispalyBare.ino
@@ -0,0 +1,25 @@
+#define DisplaySerial Serial
+
+#include "Picaso_Serial_4DLib.h"
+#include "BigDemo.h"
+#include "Picaso_Const4D.h"
+
+void setup()
+{
+  pinMode(13,OUTPUT);
+  pinMode(RESETLINE, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
+  digitalWrite(RESETLINE, 1);  // Reset the Display via D4
+  delay(100);
+  digitalWrite(RESETLINE, 0);  // unReset the Display via D4
+  delay(5000);
+    DisplaySerial.begin(9600) ;
+  Display.TimeLimit4D   = 5000 ; // 5 second timeout on all commands
+  Display.gfx_Cls() ;
+    Display.putstr("Lunokhod loading...") ;
+}
+
+void loop()
+{
+
+
+}


Create ArduinoButtonServer.ino

Create ArduinoButtonServer.ino

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

--- ArduinoButtonServer.ino
+++ ArduinoButtonServer.ino
@@ -0,0 +1,36 @@
+// This sends the state of a button, connected between the pin and GROUND to the serial connection
+// set pin numbers:
+const int buttonPin = 2;     // the number of the pushbutton pin
+// variables will change:
+int buttonState = 0;         // variable for reading the pushbutton status
+boolean firstPushed = true;
+
+void setup() {
+  pinMode(buttonPin, INPUT_PULLUP);
+  Serial.begin(57600);
+}
+
+void loop(){
+  // read the state of the pushbutton value:
+  buttonState = digitalRead(buttonPin);
+  // check if the pushbutton is pressed.
+  // if the button is not pushed the state is 'HIGH', it's more stable I guess.... pullup something
+  if (buttonState == HIGH) {
+    Serial.println("1");
+    firstPushed = true;
+  }
+  else {
+    // turn LED off:
+    if(firstPushed){
+      Serial.println("2");
+      firstPushed = false;
+    }
+    else{
+      Serial.println("3");
+    }
+
+  }
+
+}
+
+


Minor fixes

Minor fixes

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/Denzo77/OTRadioLink.git/'


Started to create a version for testing on Gemma.

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

--- arduino_proto/NFC_gemma/NFC_gemma.ino
+++ arduino_proto/NFC_gemma/NFC_gemma.ino
@@ -0,0 +1,238 @@
+/* NFC.ino  02/04/2015  D.J.Whale
+ *
+ * Please note: This program is a hardware test program only.
+ * It was written under extreme time pressure, and should only
+ * be used as a reference that defines a set of sequences that
+ * are known to work with the boards listed below. It is not
+ * in any way a representation of good programming practice...
+ * ... that takes more than a couple of hours to achieve.
+ *
+ * Test program for Arduino Uno to read a URI NDEF record from M24SR.
+ * Wire up a X-NUCLEO-NFC01A1 to the SCL/SCA pins.
+ * Download this program and run it.
+ * On the serial monitor, you should see a series of trace messages
+ * for each step, plus the URL near the end that is read back from the
+ * NDEF record.
+ * If you get loads of 00 or FF data back, you probably don't have
+ * 4.7K pullup resistors on both of SCL and SDA.
+ */
+
+//Modified for testing on Gemma.
+
+//#include <Wire.h>
+#include <TinyWireM.h>
+#define Wire TinyWireM
+
+// LEDs on X-NUCLEO board
+//#define LED1 5
+//#define LED2 4
+//#define LED3 2
+
+// LEDs on Gemma
+#define LED 1
+
+// LED is used to put a capture region around the NDEF read, so that
+// a scope or logic analyser can easily find the frames of interest
+// by triggering on rising-high of that pin.
+#define CAPTURE LED
+
+#define NFC_ADDR_7BIT 0x56
+
+void setup()
+{
+  pinMode(LED, OUTPUT);
+  //pinMode(LED2, OUTPUT);
+  //pinMode(LED3, OUTPUT);
+  Wire.begin();
+  //Serial.begin(9600);
+}
+
+byte selectI2C[]      = {0x52};
+byte selectNFCApp[]   = {0x02,0x00,0xA4,0x04,0x00,0x07,0xD2,0x76,0x00,0x00,0x85,0x01,0x01,0x00,0x35,0xC0};
+byte selectCCFile[]   = {0x03,0x00,0xA4,0x00,0x0C,0x02,0xE1,0x03,0xD2,0xAF};
+byte readCCLen[]      = {0x02,0x00,0xB0,0x00,0x00,0x02,0x6B,0x7D};
+byte readCCFile[]     = {0x03,0x00,0xB0,0x00,0x00,0x0F,0xA5,0xA2};
+byte selectNDEFFile[] = {0x02,0x00,0xA4,0x00,0x0C,0x02,0x00,0x01,0x3E,0xFD};
+byte readNDEFLen[]    = {0x03,0x00,0xB0,0x00,0x00,0x02,0x40,0x79};
+byte readNDEFMsg[]    = {0x02,0x00,0xB0,0x00,0x02,0x0C,0xA5,0xA7};
+byte deselectI2C[]    = {0xC2,0xE0,0xB4};
+
+// The delays are required, to allow the M24SR time to process commands.
+
+void loop()
+{
+  //Serial.println("\nstarting");
+  //digitalWrite(LED1, HIGH);
+
+  // kill RF, select I2C
+  //Serial.println("selectI2C");
+  digitalWrite(CAPTURE, HIGH);
+  Wire.beginTransmission(NFC_ADDR_7BIT);
+  Wire.write(selectI2C, sizeof(selectI2C));
+  Wire.endTransmission();
+  digitalWrite(CAPTURE, LOW);
+  delay(1);
+
+  //select NFC app
+  //Serial.println("selectNFCApp");
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  //Wire.write(selectNFCApp, sizeof(selectNFCApp));
+  //Wire.endTransmission();
+  //delay(1);
+  //readAndDisplay(5);
+
+
+  //select CC file
+  //Serial.println("selectCCFile");
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  //Wire.write(selectCCFile, sizeof(selectCCFile));
+  //Wire.endTransmission();
+  //delay(1);
+  //readAndDisplay(5);
+
+  //readCCLen
+  //Serial.println("readCCLen");
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  //Wire.write(readCCLen, sizeof(readCCLen));
+  //Wire.endTransmission();
+  //delay(1);
+  //readAndDisplay(7);
+
+  //int len=20; //TODO get from above payload, not overly critical
+
+  //readCCFile
+  //Serial.println("readCCFile");
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  //Wire.write(readCCFile, sizeof(readCCFile));
+  //Wire.endTransmission();
+  //delay(1);
+  //readAndDisplay(len);
+
+
+  //selectNDEFFile
+  //Serial.println("selectNDEFFile");
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  //Wire.write(selectNDEFFile, sizeof(selectNDEFFile));
+  //Wire.endTransmission();
+  //delay(1);
+  //readAndDisplay(5);
+
+
+  //readNDEFLen
+  //Serial.println("readNDEFLen");
+  //digitalWrite(CAPTURE, HIGH); // so we can capture on logic analyser
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  //Wire.write(readNDEFLen, sizeof(readNDEFLen));
+  //Wire.endTransmission();
+  //delay(1);
+
+  //Wire.requestFrom(NFC_ADDR_7BIT, 7);
+  //int idx = 0;
+  //while (Wire.available())
+  //{
+  //  byte b = Wire.read();
+  //  //Serial.print(b, HEX);
+  //  //Serial.write(' ');
+  //  if (idx == 2) // TODO max len is 255?
+  //  {
+  //    len = b;
+  //  }
+  //  idx++;
+  //}
+  //Serial.println();
+
+
+  //readNDEFMsg
+  //len = full NDEF length, (5 byte prefix+actual URI)
+  //Serial.println("readNDEFMsg");
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  // Patch in the length and fix the broken CRC
+  //readNDEFMsg[5] = len; // this is the len returned from ReadNDEFLen
+  //ComputeCrc(readNDEFMsg, sizeof(readNDEFMsg)-2, &(readNDEFMsg[6]), &(readNDEFMsg[7]));
+  //Wire.write(readNDEFMsg, sizeof(readNDEFMsg));
+  //Wire.endTransmission();
+  //delay(1);
+
+// (PCB,SW1,SW2,CRC0,CRC1)
+//#define PROTO_OVERHEAD 5
+// 5 bytes for NDEF header (in URI format)
+//#define HEADER_LEN 5
+
+  //int msgStart = 1 + HEADER_LEN;
+  //int msgEnd   = 1 + HEADER_LEN + (len-HEADER_LEN);
+
+  //Wire.requestFrom(NFC_ADDR_7BIT, len+PROTO_OVERHEAD);
+  //idx = 0;
+  //while (Wire.available())
+  //{
+  //  byte b = Wire.read();
+  //  if (idx >= msgStart && idx <= msgEnd)
+  //  {
+  //    //Serial.write(b);
+  //  }
+  //  idx++;
+  //}
+  //Serial.println();
+  //readAndDisplay(len+PROTO_OVERHEAD);
+
+  //digitalWrite(CAPTURE, LOW); // marks end of capture region for logic analyser
+
+
+  //deselectI2C
+  //Serial.println("deselectI2C");
+  //Wire.beginTransmission(NFC_ADDR_7BIT);
+  //Wire.write(deselectI2C, sizeof(deselectI2C));
+  //Wire.endTransmission();
+  //delay(1);
+  //readAndDisplay(3);
+
+  //digitalWrite(LED1, LOW);
+  //delay(1000);
+}
+
+
+//void readAndDisplay(int len)
+//{
+//  Wire.requestFrom(NFC_ADDR_7BIT, len);
+//  while (Wire.available())
+//  {
+//    Serial.print(Wire.read(), HEX);
+//    Serial.write(' ');
+//  }
+//  Serial.println();
+//}
+
+
+word UpdateCrc(byte data, word *pwCrc)
+{
+  data = (data^(byte)((*pwCrc) & 0x00FF));
+  data = (data^(data << 4));
+  *pwCrc = (*pwCrc >> 8)
+         ^ ((word)data << 8)
+         ^ ((word)data << 3)
+         ^ ((word)data >> 4);
+  return *pwCrc;
+}
+
+
+word ComputeCrc(byte *data, unsigned int len, byte *crc0, byte *crc1)
+{
+  byte bBlock;
+  word wCrc;
+
+  wCrc = 0x6363;
+
+  do
+  {
+    bBlock = *data++;
+    UpdateCrc(bBlock, &wCrc);
+  }
+  while (--len);
+
+  *crc0 = (byte) (wCrc & 0xFF);
+  *crc1 = (byte) ((wCrc >> 8) & 0xFF);
+  return wCrc;
+}
+
+/* END OF FILE */
+


First pass: set pins to a known state and let human decide if tests pass/fail.

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

--- human-readable_testbed/human-readable_testbed.ino
+++ human-readable_testbed/human-readable_testbed.ino
@@ -0,0 +1,13 @@
+void func*[] tests;
+
+void setup () {
+  // init pins
+
+  // register tests
+
+}
+
+void smokeTest() {
+
+}
+


Add chap7 - bt_relay code

Add chap7 - bt_relay code

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

--- chap7/Arduino/bt_relay/bt_relay.ino
+++ chap7/Arduino/bt_relay/bt_relay.ino
@@ -0,0 +1,23 @@
+#include <SoftwareSerial.h>
+
+SoftwareSerial BTSerial(2, 3); //Connect HC-06. Use your (TX, RX) settings
+
+void setup()
+{
+  Serial.begin(9600);
+  Serial.println("Hello!");
+
+  BTSerial.begin(9600);  // set the data rate for the BT port
+}
+
+void loop()
+{
+  // BT –> Data –> Serial
+  if (BTSerial.available()) {
+    Serial.write(BTSerial.read());
+  }
+  // Serial –> Data –> BT
+  if (Serial.available()) {
+    BTSerial.write(Serial.read());
+  }
+}


String-messages to step sequencer

String-messages to step sequencer

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

--- msgSeq/msgSeq.ino
+++ msgSeq/msgSeq.ino
@@ -0,0 +1,91 @@
+#include <Process.h>
+
+
+String instruments[] = {"PS", "BD", "SD","KI","SN","CR"};
+//PS: play sample, BD: bass drum, SD: snare, KI: kick,SN: snare, CR: crash
+const int numIns = 6;
+byte patterns[numIns-1];
+// length
+const int patternL = 8;
+
+const unsigned long MINUTE = 60000;
+int bpm = 120;
+// nextBeat
+unsigned long nextB;
+// time increase
+int nextBInc;
+// pos in the sequence
+int pos;
+// sequence-bits
+int bs[] = {1, 2, 4, 8, 16, 32, 64, 128, 256};
+
+const String sampleFolder = "/mnt/twitterOrchestra/samples/";
+
+void setup() {
+  Bridge.begin();
+  Serial.begin(9600);
+  while (!Serial);
+  String msg = "#BD 10001000";
+  parseMessage(msg);
+  String msg2 = "#SD 01010101";
+  parseMessage(msg2);
+  String msg3 = "#KI 10001010";
+  parseMessage(msg3);
+  String msg4 = "#CR 01000000";
+  parseMessage(msg4);
+
+  nextBInc = MINUTE / bpm;
+}
+
+void loop() {
+  unsigned long time = millis();
+  if (time > nextB) {
+    nextB += nextBInc;
+    for (int i = 1; i < numIns; i++) {
+      if (patterns[i-1] & bs[pos])
+        Serial.print(instruments[i]);
+      else
+        Serial.print("..");
+        Serial.print("-");
+    }
+    Serial.println("");
+    pos = (pos + 1) % patternL;
+  }
+}
+
+void parseMessage(String msg) {
+  int hashInd = msg.indexOf('#');
+  // instrument
+  if (hashInd == -1)
+    return;
+  int instrument = 0;
+  String s = msg.substring(hashInd + 1, hashInd + 3);
+  for (int i = 0; i < numIns; i++) {
+    if (s == instruments[i]) {
+      instrument = i;
+      Serial.println(s);
+      break;
+    }
+  }
+  if (instrument == 0)
+    playSample(msg.substring(hashInd + 4));
+  else {
+    instrument--;
+    // pattern
+    String pa = msg.substring(hashInd + 4, hashInd + 4 + patternL);
+    byte pattern = 0;
+    Serial.println(pa);
+    for (int i = 0; i < patternL; i++) {
+      pattern = pattern << 1;
+      byte b = pa.charAt(i) == '1' ? 1 : 0;
+      pattern += b;
+    }
+    Serial.println(pattern);
+    patterns[instrument] = pattern;
+  }
+}
+
+void playSample(String msg) {
+  Process p;
+  p.runShellCommandAsynchronously("madplay "+sampleFolder+msg);
+}


edited

edited

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/ocean-x/erikson-1.git/'


Create Main_draft_11.ino

Create Main_draft_11.ino

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

--- Main_draft_11.ino
+++ Main_draft_11.ino
@@ -0,0 +1,295 @@
+
+//**************************************************************//
+//  Name    : LAGERLOGGER! (With IC2 display)
+//  Author  : Paul Jarvey
+//  Date    : 5 Oct, 2013
+//  Modified: 17 Jan, 2017
+//  Version : BETA 0.8
+//  Notes   : 20x4 lc2 display, DHT22 temp/hum mon,
+//          : control via rotary encoder, and 4 output controls
+//          : note to self - control backlight with   lcd.setBacklight(1)
+//          : screen connected  : SDA >> A4 , SCL >> A5
+//****************************************************************
+
+//redefine how compiler understands "B_SIG", "A_SIg"
+unsigned int pulses = 0, A_SIG=0, B_SIG=1;
+int pulseAdjust = 4;
+
+// Call libraries for display, sensor, I2C, and memory. Library setup included as well.
+#include <avr/pgmspace.h>
+char buffer[20];
+
+#include <OneWire.h>
+#include <Wire.h>
+#include <LiquidCrystal_I2C.h>
+LiquidCrystal_I2C lcd(0x27,20,4);
+#include <DHT.h>
+#include <EEPROM.h>
+#include "EEPROMAnything.h"
+
+
+// Special Characters for the display and display animations
+#if defined(ARDUINO) && ARDUINO >= 100
+#define printByte(args)  write(args);
+#else
+#define printByte(args)  print(args,BYTE);
+#endif
+
+uint8_t heart[8] = { 0x0,0xa,0x1f,0x1f,0xe,0x4,0x0};
+uint8_t deg[8] = { 0x1c,0x14,0x1c,0x0,0x3,0x4,0x4,0x3};
+uint8_t hum[8] = { 0x12,0x4,0x9,0x0,0x4,0x7,0x5,0x5};
+uint8_t up1[8] = { 0x10,0x14,0x2,0x10,0x0,0x2,0x10,0x0};
+uint8_t up2[8] = { 0x0,0x2,0x10,0x0,0x2,0x10,0xa,0x0};
+uint8_t up3[8] = { 0x2,0x10,0x0,0x2,0x10,0x0,0x2,0x10};
+uint8_t Pv[8] = { 0x1c,0x14,0x1c,0x10,0x10,0x5,0x5,0x2};
+uint8_t Sv[8] = { 0xc,0x10,0x8,0x4,0x18,0x5,0x5,0x2};
+// end special chars
+
+// Sensor pins:
+#define DHTPIN 4
+#define DHTTYPE DHT22
+DHT dht(DHTPIN, DHTTYPE);
+
+//user i/o pins
+const int buttonPin = 11;    // the pin that the pushbutton is attached to
+const int ledPin = 13;       // the pin that the LED is attached to (for status)
+
+
+
+//************* Begin Libraries Setup ***************//
+
+const char* OnOff[3] = {
+"ON  ",
+"OFF ",
+"AUTO"};
+
+const char* YesNo[2] = {
+"Yes",
+"No "};
+
+
+const char* mainMenu[9] = {
+"Exit            ",
+"Program sequence",
+"Set temp/hum    ",
+"Options & PID",
+"Fan timer    ",
+"Light timer     ",
+"View sensor data",
+"Brew/grow mode  ",
+"Save settings "};
+
+
+
+
+//************* Begin Variables Setup ***************//
+
+//Sensors (ds18s20 needs additional chatter)
+int DS18S20_Pin = 5; //DS18S20 Signal pin on digital 2
+  byte addr1[8]= {0x28, 0x48, 0xAE, 0x3C, 0x05, 0x00, 0x00, 0x34};
+  byte addr2[8]= {0x28, 0xC7, 0xCD, 0x4C, 0x05, 0x00, 0x00, 0x0D};
+  byte data1[12];
+  byte data2[12];
+  byte MSB = 0;
+  byte LSB = 0;
+  float tempRead = 0;
+  float TemperatureSum = 0;
+  OneWire ds(DS18S20_Pin);
+
+//controller outputs
+int ControlCpin = 9; // control to fridge
+int ControlTpin = 7; // control to temperature/heater  (get aquarium heater)
+int ControlHpin = 8; // control to humidifier
+int ControlLpin = 6; // control to light
+int ControlApin = 10; // control to airflow
+
+//operational vars (the button)
+//int buttonPushCounter = 0;   // counter for the number of button presses DEPRACATED
+int buttonState = 0;         // current state of the button
+int lastButtonState = 0;     // previous state of the button
+boolean buttonstate = false; // calculastate of the button (includes timer delay. use this in menus)
+int buttontime = 0;          // press length measure
+int buttontimeon = 0;        // necessary for press length measure
+
+//operational vars (the rotary)
+int pulseMod = 0;            // modulus to reduce scroll speed
+int pulseprev = 0;         // to measure change in rotary position
+int pulselast = 0;         // backlight onoff
+//operational vars (the menus and presets)
+byte menu = 0;               // defines current screen (used in cases in main loop)
+byte submenu = 0;            // defines submenu screen (used in cases in main loop)
+byte Mode = 0;               // define mode: brew = 0, myc = 1 COULD JUST USE MENU
+//byte preset = 0;             // Active Preset (grow and brew)
+int selector = 0;            // could change to byte
+int selectorprev = 0;        // Must be int. Maybe long. Defines the next menu position by changing pulses
+
+//operational vars (sensors and timing)
+unsigned int sensorInterval = 5000;         // time between readings
+unsigned long int sensorTime = 0;           // current time
+unsigned long int sensorTime2 = 0;          // time of last sensor reading
+unsigned long int backlighton = 0;
+unsigned long int backlighttime = 120000;
+
+
+
+
+// fans, lights, and timers
+byte FanAuto = 0;
+unsigned long int fanONmillis = 0;
+unsigned long int fanOFFmillis = 0;
+byte fanON = 0;
+byte fanOFF = 0;
+boolean fanstate = false;
+unsigned long int Time = 0;
+unsigned long int TimeAdjust = 0;
+int brewtimer = 0;
+double brewtimerRef = 0;
+byte brewtimerON = 0;
+float brewtimerSv = 20;
+unsigned long int LightON = 0;
+unsigned long int LightOFF = 0;
+unsigned int Hours = 0;
+unsigned int Minutes = 0;
+unsigned int Seconds = 0;
+byte daysAdj = 0; //not implemented yet
+
+//key var storage
+float PvH = 0;
+double PvT = 0;
+float SvH = 0;
+double SvT = 0;
+
+
+
+//Reading averaging
+//const int numReadings = 4;   // number of readings to average (rolling average) ALSO changes loading screen length (as values are populated twice per second)
+//float readingsT[numReadings];// Temp readings to average
+//float readingsH[numReadings];// Hum readings to average
+
+//byte readingsCount = 0;
+//byte index = 0;               // index of the current reading
+//byte index2 = 0;
+//float totalT = 0;            // current Temp total
+//float totalH = 0;            // current Hum total
+//float totalIT = 0;            // current Temp total
+//fafloat totalIH = 0;
+
+float Temp1;                   //Current readings
+float Temp2;                   //Current readings
+float Temp3;                   //Current readings
+float Hum;
+int Day = 0;                //Current day in program (for calcs)
+int DayPrev = 0;            //Previous day for counting and eeprom NOT SET UP YET
+
+
+
+// Fridge limits
+int dutyCycle = 2; // in minutes
+int minCool = 10; // in minutes
+byte coolON = 0;  // PID attached to this
+
+// Heat limits
+byte heatON = 0;  // PID attached to this
+
+//PID  variables
+#include <PID_v1.h>
+byte autotune = 0;
+
+//cool
+double Kp = 8;
+double Ki = 2;
+double Kd = 2;
+double Output;
+PID coolPID(&PvT, &Output, &SvT ,Kp,Ki,Kd, REVERSE);
+double coolWindowSize = 1800000;  //  60k = 1min
+unsigned long coolWindowStartTime;
+unsigned long coolOffElapsed = 0;
+
+//heat
+double Outputh;
+PID heatPID(&PvT, &Outputh, &SvT ,4,0.8,0.8, DIRECT);
+double heatWindowSize = 600000;  // 60k = 1min
+unsigned long heatWindowStartTime;
+unsigned long heatOffElapsed = 0;
+
+
+
+// ensure setpoint, input, and outpit are defined
+
+//************* End Variables Setup ***************//
+
+
+void setup(){
+
+//Sensor start
+  dht.begin();
+
+//Interrupts initialize
+  attachInterrupt(0, A_RISE, RISING);
+  attachInterrupt(1, B_RISE, RISING);
+  pinMode(buttonPin, INPUT); // initialize momentary button input
+
+//Pin declarations
+  pinMode(ControlTpin, OUTPUT); //set outputs
+  pinMode(ControlHpin, OUTPUT);
+  pinMode(ControlLpin, OUTPUT);
+  pinMode(ControlApin, OUTPUT);
+  pinMode(ControlCpin, OUTPUT);
+  digitalWrite(ControlTpin, HIGH); // write outputs HIGH (off in this case) FIRST to prevent startup jitters.
+  digitalWrite(ControlHpin, HIGH);
+  digitalWrite(ControlLpin, HIGH);
+  digitalWrite(ControlApin, HIGH);
+  digitalWrite(ControlCpin, HIGH);
+
+//LCD and special chars
+  Serial.begin(115200);
+  lcd.init();
+  lcd.backlight();
+  lcd.createChar(0, heart);
+  lcd.createChar(1, deg);
+  lcd.createChar(2, hum);
+  lcd.createChar(3, up1);
+  lcd.createChar(4, up2);
+  lcd.createChar(5, up3);
+  lcd.createChar(6, Pv);
+  lcd.createChar(7, Sv);
+  lcd.clear();
+  LoadScreen();
+
+// load all the saved values from EEPROM
+  EEPROM_recall();
+
+  //fanONmillis = 0;
+  fanOFFmillis = millis();
+  HomeSetup();
+
+  //PID shit
+  //coolWindowSize = dutyCycle * 60000;
+  coolPID.SetOutputLimits(0, coolWindowSize/1000);
+  coolPID.SetMode(AUTOMATIC);
+  coolOffElapsed = millis();
+  heatPID.SetOutputLimits(0, heatWindowSize/1000);
+  heatPID.SetMode(AUTOMATIC);
+  coolOffElapsed = millis();
+}
+
+
+void loop(){
+
+  Button();
+  Menus ();
+
+  /* //TESTING OUTPUT (enable this line to print interrupt data to the serial port
+  Serial.print(pulses);
+  Serial.print(" : ");
+  Serial.println(pulseMod);*/
+
+
+}
+
+
+
+
+
+
+


Demonstrating MM3 usage with interrupts for convert and reading.

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

--- examples/MicroMagConvGetResInt/MicroMagConvGetResInt.ino
+++ examples/MicroMagConvGetResInt/MicroMagConvGetResInt.ino
@@ -0,0 +1,174 @@
+/*
+ * MicroMagConvGetRes.ino
+ * Author: Steve Marple
+ * License: GNU Lesser General Public License, version 2.1
+ *
+ * Example sketch to demonstrate reading from a MicroMag2 or MicroMag3
+ * module using the convert() and getResult() functions. The initial
+ * convert is started from a match interrupt generated by
+ * timer/counter2.
+ *
+ * Requirements:
+ *   Arduino >= 1.0
+ *   Calunium (standard Arduino cannot access the DRDY pin and the
+ *     Arduino Mega(2560) doesn't have timer/counter2 connected to the
+ *     shield headers.
+ *   MicroMag library, see https://github.com/stevemarple/MicroMag
+ *   MicroMag2 or MicroMag3 module
+ *
+ *   Calunium configuration:
+ *     RTC (DS1307 or similar) fitted, with battery
+ *     RTC square wave routed to D15 (JP1 fitted)
+ */
+
+#include <Wire.h>
+#include <RealTimeClockDS1307.h>
+
+#include <SPI.h>
+#include <MicroMag.h>
+
+#include <util/atomic.h>
+
+// Adjust these pin definitions to suit your hardware. They are chosen
+// to match the RN-XV and SD shield with the MicroMag3 module option
+// on Calunium. Ensure the correct interrupt service routine is
+// defined for the DRDY pin.
+#define DRDY_PIN 14
+const uint8_t mmResetPin = A3;
+const uint8_t mmDrdyPin = DRDY_PIN;
+const uint8_t mmSsPin = A0; // This is the chip select pin on the MM3
+
+// Change this to suit your version.
+const uint8_t model = 3;
+
+// The sampling period
+uint8_t period = MM_PERIOD_4096;
+
+// Create a MicroMag object
+MicroMag MM = MicroMag::MicroMag3(mmSsPin, mmDrdyPin, mmResetPin);
+
+// Use an 8-bit variable to obtain atomic read/write access. Disabling
+// interrupts is therefore not needed.
+/// volatile uint8_t dataReady = false;
+
+// The 2 or 3 samples are taken in different invocations of loop() so
+// use static variables to hold the results until all 2 or 3 have been
+// taken and can be printed.
+volatile uint8_t axis = 0;
+volatile uint8_t sampleInProgess = false;
+volatile int16_t data[model];
+volatile unsigned long timestamps[model] = {0};
+
+
+// This ISR is called when the state has *changed*. Act only when the
+// current state is high (data is ready)
+ISR(PCINT2_vect){
+  ATOMIC_BLOCK(ATOMIC_FORCEON) {
+    if (!digitalRead(DRDY_PIN))
+      return; // Data not ready (new sample started?)
+
+    data[axis] = MM.getResult();
+    ++axis;
+    if (axis == model)
+      sampleInProgess = false;
+    else {
+      timestamps[axis] = millis();
+      MM.convert(axis, period); // Start sampling next axis
+    }
+    return;
+  }
+}
+
+void setupPinChangeInterrupts(void)
+{
+  *(digitalPinToPCMSK(DRDY_PIN)) |= _BV(digitalPinToPCMSKbit(DRDY_PIN));
+  *(digitalPinToPCIR(DRDY_PIN)) |= _BV(digitalPinToPCICRbit(DRDY_PIN));
+}
+
+// When the counter matches sample X
+ISR(TIMER2_COMPA_vect)
+{
+  ATOMIC_BLOCK(ATOMIC_FORCEON) {
+    if (sampleInProgess)
+      return;
+    sampleInProgess = true;
+    axis = 0;
+    timestamps[axis] = millis();
+    MM.convert(axis, period);
+    return;
+  }
+}
+
+// Configure counter/timer2 in asynchronous mode, counting the rising
+// edge of signals on TOSC1. This always triggers on the rising edge;
+// if connecting SQW from a DS1307 then this means the ticks occur
+// halfway through the second.
+void setupTimer2(void)
+{
+  noInterrupts();
+  ASSR = (_BV(EXCLK) | _BV(AS2));
+  TCCR2A = 0;
+  TCCR2B = 0;
+  TCNT2 = 0;
+  OCR2A = 3; // Have the ISR called every 10th (n+1) tick
+  TCCR2A |= _BV(WGM21); // CTC mode
+  TCCR2B |= _BV(CS20);
+  TIMSK2 |= _BV(OCIE2A);
+  interrupts();
+}
+
+
+void setup()
+{
+  pinMode(SS, OUTPUT); // Prevent SPI slave mode from happening
+  Wire.begin();
+  Serial.begin(9600);
+
+  // For calunium: enable inputs on pin 6 in case JP4 is fitted and
+  // routing SQW there also
+  pinMode(6, INPUT);
+
+  // On Calunium timer/counter2 is connected to digital pin 15.
+  pinMode(15, INPUT);
+  setupTimer2();
+
+  if (MM.begin() != 0) {
+    Serial.println("Could not initialise MicroMag");
+    while (1)
+      ; // no point in continuing
+  }
+  setupPinChangeInterrupts();
+
+  // Set up the RTC output
+  RTC.sqwEnable(RealTimeClockDS1307::SQW_1Hz);
+}
+
+unsigned long lastDisplayed = 0;
+void loop()
+{
+  // Check if new data is ready
+  if (!sampleInProgess && axis == model && timestamps[0] != lastDisplayed) {
+    lastDisplayed = timestamps[0];
+    double total = 0.0;
+
+    // Display the results
+    for (uint8_t i = 0; i < model; ++i) {
+      if (i)
+	Serial.print("   ");
+      Serial.print(char('X' + i));
+      Serial.print(" = ");
+      Serial.print(data[i]);
+      total += sqrt(double(data[i]) * data[i]);
+    }
+    Serial.print("   Total = ");
+    Serial.println(total);
+
+    for (uint8_t i = 0; i < model; ++i) {
+      if (i)
+	Serial.print("   ");
+      Serial.print(timestamps[i]);
+    }
+    Serial.println();
+  }
+
+}


Removed deprecated parameters

Removed deprecated parameters

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/TheBeachMaster/AfricasTalkingIOT.git/'


add morse code dictionary

add morse code dictionary

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/kdomen/Morse-Code.git/'


hello-world firmware

hello-world firmware

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

--- firmware/firmware.ino
+++ firmware/firmware.ino
@@ -0,0 +1,277 @@
+// ATmega328/Arduino -> GPIB pin mapping
+//
+//                       +------------\_/------------+
+//                      -|1  PC6 INT14   INT13 PC5 28|- A5     GPIB 11: ATN
+//  FT230X 4: RX     D0 -|2  PD0 INT16   INT12 PC4 27|- A4     GPIB 10: SRQ
+//  FT230X 1: TX     D1 -|3  PD1 INT17   INT11 PC3 26|- A3     GPIB 9:  IFC
+//  FT230X 6: CTS    D2 -|4  PD2 INT18   INT10 PC2 25|- A2     GPIB 8:  NDAC
+//  FT230X 2: RTS    D3 -|5  PD3 INT19    INT9 PC1 24|- A1     GPIB 7:  NRFD
+//                   D4 -|6  PD4 INT20    INT8 PC0 23|- A0     GPIB 6:  DAV
+//                  Vcc -|7                        22|- GND
+//                  GND -|8                        21|- AREF
+//                      -|9  PB6 INT6              20|- AVcc
+//   GPIB 5: EOI        -|10 PB7 INT7     INT5 PB5 19|- D13    GPIB 17: REN
+//   GPIB 4: DIO4    D5 -|11 PD5 INT21    INT4 PB4 18|- D12    GPIB 16: DIO8
+//   GPIB 3: DIO3    D6 -|12 PD6 INT22    INT3 PB3 17|- D11    GPIB 15: DIO7
+//   GPIB 2: DIO2    D7 -|13 PD7 INT23    INT2 PB2 16|- D10    GPIB 14: DIO6
+//   GPIB 1: DIO1    D8 -|14 PD8 INT0     INT1 PB1 15|- D9     GPIB 13: DIO5
+//                       +---------------------------+
+
+// Notes:
+
+// Next board revision:
+// - Move EOI to Arduino pin D4 so that it is controllable via Arduino code.
+
+// Sounds like the listening device is the one which should enable pull-up resistors.
+// See http://www.eevblog.com/forum/testgear/gpib-to-usb-controlleradapter/msg349323/#msg349323
+
+
+// --- Bit manipulation ---
+
+#define SET_BIT(ADDRESS, BITNUM)   (ADDRESS |= (1<<BITNUM))
+#define CLEAR_BIT(ADDRESS, BITNUM) (ADDRESS &= ~(1<<BITNUM))
+#define FLIP_BIT(ADDRESS, BITNUM)  (ADDRESS ^= (1<<BITNUM))
+// note: this returns a byte with the desired bit in its original position
+#define GET_BIT(ADDRESS, BITNUM)   (ADDRESS & (1<<BITNUM))
+
+
+// --- Types ---
+
+typedef uint8_t arduino_pin_t;
+typedef uint8_t arduino_pinmode_t;
+typedef uint8_t byte_t;
+typedef uint8_t bit_t;
+
+
+// --- TTL Serial pin mapping ---
+
+#define RX_ARDUINO_PIN   1  // connect to FT230X TX (pin 1)
+#define TX_ARDUINO_PIN   0  // connect to FT230X RX (pin 4)
+#define CTS_ARDUINO_PIN  3
+#define RTS_ARDUINO_PIN  4
+
+
+// --- Handshake bus ---
+
+#define DAV_ARDUINO_PIN   A0
+#define NRFD_ARDUINO_PIN  A1
+#define NDAC_ARDUINO_PIN  A2
+
+
+void assert_dav() {
+    assert_arduino_pin(DAV_ARDUINO_PIN);
+}
+
+void assert_nrfd() {
+    assert_arduino_pin(NRFD_ARDUINO_PIN);
+}
+
+void assert_ndac() {
+    assert_arduino_pin(NDAC_ARDUINO_PIN);
+}
+
+
+void unassert_dav() {
+    unassert_arduino_pin(DAV_ARDUINO_PIN);
+}
+
+void unassert_nrfd() {
+    unassert_arduino_pin(NRFD_ARDUINO_PIN);
+}
+
+void unassert_ndac() {
+    unassert_arduino_pin(NDAC_ARDUINO_PIN);
+}
+
+
+boolean check_dav() {
+    return digitalRead(DAV_ARDUINO_PIN) == LOW ? true : false;
+}
+
+boolean check_nrfd() {
+    return digitalRead(NRFD_ARDUINO_PIN) == LOW ? true : false;
+}
+
+boolean check_ndac() {
+    return digitalRead(NDAC_ARDUINO_PIN) == LOW ? true : false;
+}
+
+
+// --- Interface management bus ---
+
+#define IFC_ARDUINO_PIN  A3
+#define ATN_ARDUINO_PIN  A5
+#define SRQ_ARDUINO_PIN  A4
+#define REN_ARDUINO_PIN  13
+
+
+void assert_ifc() {
+    assert_arduino_pin(IFC_ARDUINO_PIN);
+}
+
+void assert_atn() {
+    assert_arduino_pin(IFC_ARDUINO_PIN);
+}
+
+void assert_srq() {
+    assert_arduino_pin(SRQ_ARDUINO_PIN);
+}
+
+void assert_ren() {
+    assert_arduino_pin(REN_ARDUINO_PIN);
+}
+
+void assert_eoi() {
+    // Configure pin as output
+    SET_BIT(DDRB, DDB7);
+    // Set the pin low
+    CLEAR_BIT(PORTB, PB7);
+}
+
+
+void unassert_ifc() {
+    unassert_arduino_pin(IFC_ARDUINO_PIN);
+}
+
+void unassert_atn() {
+    unassert_arduino_pin(IFC_ARDUINO_PIN);
+}
+
+void unassert_srq() {
+    unassert_arduino_pin(SRQ_ARDUINO_PIN);
+}
+
+void unassert_ren() {
+    unassert_arduino_pin(REN_ARDUINO_PIN);
+}
+
+void unassert_eoi() {
+    // Configure pin as input
+    CLEAR_BIT(DDRB, DDB7);
+    // Enable the built-in pull-up resistor
+    SET_BIT(PORTB, PB7);
+}
+
+
+boolean check_ifc() {
+    return digitalRead(IFC_ARDUINO_PIN) == LOW ? true : false;
+}
+
+boolean check_atn() {
+    return digitalRead(ATN_ARDUINO_PIN) == LOW ? true : false;
+}
+
+boolean check_srq() {
+    return digitalRead(SRQ_ARDUINO_PIN) == LOW ? true : false;
+}
+
+boolean check_ren() {
+    return digitalRead(REN_ARDUINO_PIN) == LOW ? true : false;
+}
+
+boolean check_eoi() {
+    return GET_BIT(PINB, PINB7) == 0 ? true : false;
+}
+
+
+// --- Data bus ---
+
+#define DIO1_ARDUINO_PIN  8
+#define DIO2_ARDUINO_PIN  7
+#define DIO3_ARDUINO_PIN  6
+#define DIO4_ARDUINO_PIN  5
+#define DIO5_ARDUINO_PIN  9
+#define DIO6_ARDUINO_PIN  10
+#define DIO7_ARDUINO_PIN  11
+#define DIO8_ARDUINO_PIN  12
+
+
+void gpib_write(byte_t data) {
+    set_gpib_data_bus_mode(OUTPUT);
+    digitalWrite(DIO1_ARDUINO_PIN, GET_BIT(data, 0));
+    digitalWrite(DIO2_ARDUINO_PIN, GET_BIT(data, 1));
+    digitalWrite(DIO3_ARDUINO_PIN, GET_BIT(data, 2));
+    digitalWrite(DIO4_ARDUINO_PIN, GET_BIT(data, 3));
+    digitalWrite(DIO5_ARDUINO_PIN, GET_BIT(data, 4));
+    digitalWrite(DIO6_ARDUINO_PIN, GET_BIT(data, 5));
+    digitalWrite(DIO7_ARDUINO_PIN, GET_BIT(data, 6));
+    digitalWrite(DIO8_ARDUINO_PIN, GET_BIT(data, 7));
+}
+
+byte_t gpib_read() {
+    set_gpib_data_bus_mode(INPUT_PULLUP);
+    byte_t data;
+    digitalRead(DIO1_ARDUINO_PIN) ? CLEAR_BIT(data, 0) : SET_BIT(data, 0);
+    digitalRead(DIO2_ARDUINO_PIN) ? CLEAR_BIT(data, 1) : SET_BIT(data, 1);
+    digitalRead(DIO3_ARDUINO_PIN) ? CLEAR_BIT(data, 2) : SET_BIT(data, 2);
+    digitalRead(DIO4_ARDUINO_PIN) ? CLEAR_BIT(data, 3) : SET_BIT(data, 3);
+    digitalRead(DIO5_ARDUINO_PIN) ? CLEAR_BIT(data, 4) : SET_BIT(data, 4);
+    digitalRead(DIO6_ARDUINO_PIN) ? CLEAR_BIT(data, 5) : SET_BIT(data, 5);
+    digitalRead(DIO7_ARDUINO_PIN) ? CLEAR_BIT(data, 6) : SET_BIT(data, 6);
+    digitalRead(DIO8_ARDUINO_PIN) ? CLEAR_BIT(data, 7) : SET_BIT(data, 7);
+    return data;
+}
+
+void set_gpib_data_bus_mode(arduino_pinmode_t mode) {
+    pinMode(DIO1_ARDUINO_PIN, mode);
+    pinMode(DIO2_ARDUINO_PIN, mode);
+    pinMode(DIO3_ARDUINO_PIN, mode);
+    pinMode(DIO4_ARDUINO_PIN, mode);
+    pinMode(DIO5_ARDUINO_PIN, mode);
+    pinMode(DIO6_ARDUINO_PIN, mode);
+    pinMode(DIO7_ARDUINO_PIN, mode);
+    pinMode(DIO8_ARDUINO_PIN, mode);
+}
+
+
+// --- Arduino pin driver ---
+
+void assert_arduino_pin(arduino_pin_t pin) {
+    pinMode(pin, OUTPUT);
+    digitalWrite(pin, LOW);
+}
+
+void unassert_arduino_pin(arduino_pin_t pin) {
+    pinMode(pin, INPUT_PULLUP);
+}
+
+
+// --- Main program ---
+
+#include <SoftwareSerial.h>
+SoftwareSerial serial = SoftwareSerial(RX_ARDUINO_PIN, TX_ARDUINO_PIN);
+
+void setup() {
+    // Configure the serial pins
+    pinMode(RX_ARDUINO_PIN, INPUT);
+    pinMode(TX_ARDUINO_PIN, OUTPUT);
+    serial.begin(9600);
+}
+
+void loop() {
+    // let's start by just getting a simple "hello" program to work.
+    serial.write("hello!\n");
+    delay(1000);
+}
+
+
+// I burn this program onto an ATmega328 using the Arduino 1.6.x IDE by writing it to the
+// ATmega328 in an Arduino Uno board.  I then remove the ATmega328 from the Uno and insert
+// it into the atmega-gpib board.
+
+// To accomplish this, you'll need to set the ATmega328's fuse bits so that it is configured
+// to use its internal 8MHz oscillator.  See the instructions at the bottom of this page:
+// https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard
+
+// Download this Arduino hardware configuration:
+// https://www.arduino.cc/en/uploads/Tutorial/breadboard-1-6-x.zip
+// Create a "hardware" folder in your Arduino folder and move the breadboard folder there.
+// For example, on my linux computer, the "boards.txt" file sits at this path:
+// /home/cell/Arduino/hardware/breadboard/avr/boards.txt
+
+// Note: if you get a "permission denied" error when trying to use the USBTiny programmer
+// from linux, do the following:
+// - Run `lsusb` and look for a line like the following:
+//     Bus 001 Device 016: ID 1781:0c9f Multiple Vendors USBtiny
+// - The above device corresponds to the device file /dev/bus/usb/001/016.  Chmod it:
+//     sudo chmod ugo+rw /dev/bus/usb/001/016


Add example arduino program.

Add example arduino program.

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

--- arduino/serial_test.ino
+++ arduino/serial_test.ino
@@ -0,0 +1,43 @@
+/* Copyright 2012 Google Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ *
+ * Project home page: http://code.google.com/p/usb-serial-for-android/
+ */
+
+// Sample Arduino sketch for use with usb-serial-for-android.
+// Prints an ever-increasing counter, and writes back anything
+// it receives.
+
+static int counter = 0;
+void setup() {
+  Serial.begin(115200);
+}
+
+void loop() {
+  Serial.print("Tick #");
+  Serial.print(counter++, DEC);
+  Serial.print("\n");
+
+  if (Serial.peek() != -1) {
+    Serial.print("Read: ");
+    do {
+      Serial.print((char) Serial.read());
+    } while (Serial.peek() != -1);
+    Serial.print("\n");
+  }
+  delay(1000);
+}


uploaded Exercise01_StartingPoint.ino

uploaded Exercise01_StartingPoint.ino

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

--- exercises/01/Exercise01_StartingPoint/Exercise01_StartingPoint.ino
+++ exercises/01/Exercise01_StartingPoint/Exercise01_StartingPoint.ino
@@ -0,0 +1,10 @@
+void setup()
+{
+  pinMode(2, OUTPUT); // Enables pin 2 on the Arduino to Send enough power (current)
+                                       // to turn on LED attached to pin 2}
+}
+
+void loop()
+{
+   delay(5000);  // wait 5000ms or 5 seconds before going to the next line
+}


add rpinoTest Project

add rpinoTest Project

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

--- rapinoTest/temphumi.ino
+++ rapinoTest/temphumi.ino
@@ -0,0 +1,26 @@
+const int analogPin0 = A0;
+const int analogPin1 = A1;
+const float volt = 0.001074219;
+
+float RH = 0;
+float T1 = 0;
+
+void setup() {
+  Serial.begin(57600);
+  analogReference(INTERNAL);
+}
+
+void loop() {
+  RH = analogRead(analogPin0);
+  T1 = analogRead(analogPin1);
+
+  RH = RH * volt * 100;
+  T1 = (T1 * volt *200)-50;
+
+  Serial.print("RH:" );
+  Serial.println(RH,2);
+  Serial.print("T:");
+  Serial.println(T1,2);
+
+  delay(2000);
+}


Add office IPs

Add office IPs

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/lgramatikov/celeste.git/'


Delete Lightning862OrangeAndBlue.ino

Delete Lightning862OrangeAndBlue.ino

changed file structure

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/nolanpatrick/spi_leds_862.git/'


Russian comments

Russian comments

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

--- Info_ru.ino
+++ Info_ru.ino
@@ -0,0 +1,85 @@
+/*
+ * Программа, регистрирующая влажность, температуру и яркость
+ * Отправляет результаты на COM port
+ * Формат вывода: H=1.0;T=1.0;LL=1;
+ */
+
+//Пин фоторезистора (аналоговый)
+int lightPin = 0;
+
+// Пин DHT-11 (цифровой)
+int DHpin = 8;
+
+// Массив, хранящий данные DHT-11
+byte dat[5];
+
+// Первоначальная настройка
+void setup()
+{
+	Serial.begin(9600);
+	pinMode(DHpin,OUTPUT);
+}
+
+ /*
+ * Выполняется после setup()
+ * Основной бесконечный цикл
+ */
+void loop()
+{
+	delay(1000); // Замер примерно 1 раз в секунду
+	int lightLevel = analogRead(lightPin); //Получаем уровень освещённости
+
+	temp_hum(); // Получаем температуру и влажность в переменную dat
+	// И выводим результат
+	Serial.print("H=");
+	Serial.print(dat[0], DEC);
+	Serial.print('.');
+	Serial.print(dat[1],DEC);
+	Serial.print(";T=");
+	Serial.print(dat[2], DEC);
+	Serial.print('.');
+	Serial.print(dat[3],DEC);
+	Serial.print(";LL=");
+	Serial.print(lightLevel);
+	Serial.println(";");
+}
+
+// Получить данные от DHT-11 в dat
+void temp_hum()
+{
+	digitalWrite(DHpin,LOW);
+	delay(30);
+	digitalWrite(DHpin,HIGH);
+	delayMicroseconds(40);
+	pinMode(DHpin,INPUT);
+	while(digitalRead(DHpin) == HIGH);
+	delayMicroseconds(80);
+	if(digitalRead(DHpin) == LOW);
+	delayMicroseconds(80);
+	for(int i=0;i<4;i++)
+	{
+	  dat[i] = read_data();
+	}
+	pinMode(DHpin,OUTPUT);
+	digitalWrite(DHpin,HIGH);
+}
+
+// Получить часть данных от DHT-11
+byte read_data()
+{
+	byte data;
+	for(int i=0; i<8; i++)
+	{
+		if(digitalRead(DHpin) == LOW)
+		{
+			while(digitalRead(DHpin) == LOW);
+			delayMicroseconds(30);
+			if(digitalRead(DHpin) == HIGH)
+			{
+				data |= (1<<(7-i));
+			}
+			while(digitalRead(DHpin) == HIGH);
+		}
+	}
+	return data;
+}


second try for leaderboard. saw ghost

second try for leaderboard. saw ghost

error: pathspec 'exploration' did not match any file(s) known to git
error: pathspec 'testing/src/main.ino' did not match any file(s) known to git


DP-4401 Created sketch to send measurement in response to actuation

Signed-off-by: Marek Tomczewski <b8f517ce36d6e79015cc2772a688db5feb1db6a6@intel.com>

DP-4401 Removed checking component name. Logging to Serial.

Signed-off-by: Marek Tomczewski <b8f517ce36d6e79015cc2772a688db5feb1db6a6@intel.com>

DP-4401 Changed sketch description.

Signed-off-by: Marek Tomczewski <b8f517ce36d6e79015cc2772a688db5feb1db6a6@intel.com>

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

--- arduino/IoTkit/examples/IoTKitSendObservationInResponseToActuation/IoTKitSendObservationInResponseToActuation.ino
+++ arduino/IoTkit/examples/IoTKitSendObservationInResponseToActuation/IoTKitSendObservationInResponseToActuation.ino
@@ -0,0 +1,77 @@
+/*
+Copyright (c) 2015, Intel Corporation
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+//This example reacts for default actuator component if registered on device
+//Prequisites:
+// 1. Device must be activated
+// 2. A component named "power" of actuator type with number data type
+//This example sends back numeric value to an actuator when actuation is received
+
+#include <IoTkit.h>    // include IoTkit.h to use the Intel IoT Kit
+#include <Ethernet.h>  // must be included to use IoTkit
+#include <aJSON.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+// create an object of the IoTkit class
+IoTkit iotkit;
+int temp;
+char buf[112];
+
+void setup() {
+  Serial.begin(115200);
+  // call begin on the IoTkit object before calling any other methods
+  iotkit.begin();
+  delay(10500);
+  iotkit.send("power", 1);
+}
+
+void loop() {
+  iotkit.receive(callback);
+  delay(5000);
+}
+
+void callback(char* json) {
+  Serial.println(json);
+  aJsonObject* parsed = aJson.parse(json);
+  if (&parsed == NULL) {
+    // invalid or empty JSON
+    Serial.println("received invalid JSON");
+    return;
+  }
+
+  aJsonObject* component = aJson.getObjectItem(parsed, "component");
+  aJsonObject* command = aJson.getObjectItem(parsed, "command");
+  aJsonObject* argv = aJson.getObjectItem(parsed, "argv");
+  aJsonObject* argvArray = argv->child;
+  aJsonObject* name = argvArray->child; // name : on
+  aJsonObject* value = name->next; // value: string
+
+  if ((component != NULL)) {
+      if ((command != NULL)) {
+        Serial.println("Sending actuation value to cloud");
+        iotkit.send("power", atoi(value->valuestring));
+      }
+  }
+}


CheckFlashConfig.ino

CheckFlashConfig.ino

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

--- _22-CheckFlashConfig/CheckFlashConfig.ino
+++ _22-CheckFlashConfig/CheckFlashConfig.ino
@@ -0,0 +1,34 @@
+/*
+    https://github.com/esp8266/Arduino/blob/master/libraries/esp8266/examples/CheckFlashConfig/CheckFlashConfig.ino
+
+ ESP8266 CheckFlashConfig by Markus Sattler
+
+ This sketch tests if the EEPROM settings of the IDE match to the Hardware
+
+ */
+
+void setup(void) {
+    Serial.begin(115200);
+}
+
+void loop() {
+
+    uint32_t realSize = ESP.getFlashChipRealSize();
+    uint32_t ideSize = ESP.getFlashChipSize();
+    FlashMode_t ideMode = ESP.getFlashChipMode();
+
+    Serial.printf("Flash real id:   %08X\n", ESP.getFlashChipId());
+    Serial.printf("Flash real size: %u\n\n", realSize);
+
+    Serial.printf("Flash ide  size: %u\n", ideSize);
+    Serial.printf("Flash ide speed: %u\n", ESP.getFlashChipSpeed());
+    Serial.printf("Flash ide mode:  %s\n", (ideMode == FM_QIO ? "QIO" : ideMode == FM_QOUT ? "QOUT" : ideMode == FM_DIO ? "DIO" : ideMode == FM_DOUT ? "DOUT" : "UNKNOWN"));
+
+    if(ideSize != realSize) {
+        Serial.println("Flash Chip configuration wrong!\n");
+    } else {
+        Serial.println("Flash Chip configuration ok.\n");
+    }
+
+    delay(5000);
+}


Añadido proyecto básico de Arduino

Añadido proyecto básico de Arduino

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

--- proyecto/proyecto.ino
+++ proyecto/proyecto.ino
@@ -0,0 +1,23 @@
+/*
+  Empotrados
+  Prctica de empotrados
+
+  Modulo principal de la aplicacion
+  del juego de mesa con Arduino
+
+  by:
+  - Jesus Alcalde
+  - Adrian Gutierrez
+  - Javier Jimenez
+ */
+
+
+// the setup function runs once when you press reset or power the board
+void setup() {
+
+}
+
+// the loop function runs over and over again forever
+void loop() {
+
+}


Firmare for Arduino Leonardo

Firmare for Arduino Leonardo

error: pathspec '0_Test_Device/Python/tclab2/tclab2.ino' did not match any file(s) known to git

--- 0_Test_Device/Python/tclab2/tclab2.ino
+++ 0_Test_Device/Python/tclab2/tclab2.ino
@@ -0,0 +1,316 @@
+/*
+  TCLab Temperature Control Lab Firmware
+  Jeffrey Kantor
+  February, 2019
+
+  This firmware provides a high level interface to the Temperature Control Lab. The
+  firmware scans the serial port for commands. Commands are case-insensitive. Any
+  unrecognized command results in sleep model. Each command returns a result string.
+
+  A         software restart. Returns "Start".
+  LED float set LED to float for 10 sec. range 0 to 100. Returns actual float
+  P1 float  set pwm limit on heater 1, range 0 to 255. Default 200. Returns P1.
+  P2 float  set pwm limit on heater 2, range 0 to 255. Default 100. Returns P2.
+  Q1 float  set Heater 1, range 0 to 100. Returns value of Q1.
+  Q2 float  set Heater 2, range 0 to 100. Returns value of Q2.
+  R1        get value of Heater 1, range 0 to 100
+  R2        get value of Heater 2, range 0 to 100
+  SCAN      get values T1 T2 Q1 Q1 in line delimited values
+  T1        get Temperature T1. Returns value of T1 in °C.
+  T2        get Temperature T2. Returns value of T2 in °C.
+  VER       get firmware version string
+  X         stop, enter sleep mode. Returns "Stop"
+
+  Limits on the heater can be configured with the constants below.
+
+  Status is indicated by LED1 on the Temperature Control Lab. Status conditions are:
+
+      LED1        LED1
+      Brightness  State
+      ----------  -----
+      dim         steady     Normal operation, heaters off
+      bright      steady     Normal operation, heaters on
+      dim         blinking   High temperature alarm on, heaters off
+      bright      blinking   High temperature alarm on, heaters on
+
+  The Temperature Control Lab shuts down the heaters if it receives no host commands
+  during a timeout period (configure below), receives an "X" command, or receives
+  an unrecognized command from the host.
+
+  The constants can be used to configure the firmware.
+
+  Version History
+      1.0.1 first version included in the tclab package
+      1.1.0 added R1 and R2 commands to read current heater values
+            modified heater values to units of percent of full power
+            added P1 and P2 commands to set heater power limits
+            rewrote readCommand to avoid busy states
+            simplified LED status model
+      1.2.0 added LED command
+      1.2.1 correctly reset heater values on close
+            added version history
+      1.2.2 shorten version string for better display by TCLab
+      1.2.3 move baudrate to from 9600 to 115200
+      1.3.0 add SCAN function
+            report board type in version string
+      1.4.0 changed Q1 and Q2 to float from int
+      1.4.1 fix missing Serial.flush() at end of command loop
+      1.4.2 fix bug with X command
+      1.4.3 required Arduino IDE Version >= 1.0.0
+      1.5.0 remove webusb
+*/
+
+#include "Arduino.h"
+
+// determine board type
+#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
+  String boardType = "Arduino Uno";
+#elif defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
+  String boardType = "Arduino Leonardo/Micro";
+#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
+  String boardType = "Arduino Mega";
+#else
+  String boardType = "Unknown board";
+#endif
+
+// Enable debugging output
+const bool DEBUG = false;
+
+// constants
+const String vers = "1.4.3";   // version of this firmware
+const long baud = 115200;      // serial baud rate
+const char sp = ' ';           // command separator
+const char nl = '\n';          // command terminator
+
+// pin numbers corresponding to signals on the TC Lab Shield
+const int pinT1   = 0;         // T1
+const int pinT2   = 2;         // T2
+const int pinQ1   = 3;         // Q1
+const int pinQ2   = 5;         // Q2
+const int pinLED1 = 9;         // LED1
+
+// temperature alarm limits
+const int limT1   = 50;       // T1 high alarm (°C)
+const int limT2   = 50;       // T2 high alarm (°C)
+
+// LED1 levels
+const int hiLED   =  60;       // hi LED
+const int loLED   = hiLED/16;  // lo LED
+
+// global variables
+char Buffer[64];               // buffer for parsing serial input
+int buffer_index = 0;          // index for Buffer
+String cmd;                    // command
+float val;                     // command value
+int ledStatus;                 // 1: loLED
+                               // 2: hiLED
+                               // 3: loLED blink
+                               // 4: hiLED blink
+long ledTimeout = 0;           // when to return LED to normal operation
+float LED = 100;               // LED override brightness
+float P1 = 200;                // heater 1 power limit in units of pwm. Range 0 to 255
+float P2 = 100;                // heater 2 power limit in units in pwm, range 0 to 255
+float Q1 = 0;                  // last value written to heater 1 in units of percent
+float Q2 = 0;                  // last value written to heater 2 in units of percent
+int alarmStatus;               // hi temperature alarm status
+boolean newData = false;       // boolean flag indicating new command
+
+
+void readCommand() {
+  while (Serial && (Serial.available() > 0) && (newData == false)) {
+    int byte = Serial.read();
+    if ((byte != '\r') && (byte != nl) && (buffer_index < 64)) {
+      Buffer[buffer_index] = byte;
+      buffer_index++;
+    }
+    else {
+      newData = true;
+    }
+  }
+}
+
+// for debugging with the serial monitor in Arduino IDE
+void echoCommand() {
+  if (newData) {
+    Serial.write("Received Command: ");
+    Serial.write(Buffer, buffer_index);
+    Serial.write(nl);
+    Serial.flush();
+  }
+}
+
+// return thermister temperature in °C
+inline float readTemperature(int pin) {
+  return analogRead(pin) * 0.3223 - 50.0;
+}
+
+void parseCommand(void) {
+  if (newData) {
+    String read_ = String(Buffer);
+
+    // separate command from associated data
+    int idx = read_.indexOf(sp);
+    cmd = read_.substring(0, idx);
+    cmd.trim();
+    cmd.toUpperCase();
+
+    // extract data. toFloat() returns 0 on error
+    String data = read_.substring(idx + 1);
+    data.trim();
+    val = data.toFloat();
+
+    // reset parameter for next command
+    memset(Buffer, 0, sizeof(Buffer));
+    buffer_index = 0;
+    newData = false;
+  }
+}
+
+void sendResponse(String msg) {
+  Serial.println(msg);
+}
+
+void dispatchCommand(void) {
+  if (cmd == "A") {
+    setHeater1(0);
+    setHeater2(0);
+    sendResponse("Start");
+  }
+  else if (cmd == "LED") {
+    ledTimeout = millis() + 10000;
+    LED = max(0, min(100, val));
+    sendResponse(String(LED));
+  }
+  else if (cmd == "P1") {
+    P1 = max(0, min(255, val));
+    sendResponse(String(P1));
+  }
+  else if (cmd == "P2") {
+    P2 = max(0, min(255, val));
+    sendResponse(String(P2));
+  }
+  else if (cmd == "Q1") {
+    setHeater1(val);
+    sendResponse(String(Q1));
+  }
+  else if (cmd == "Q2") {
+    setHeater2(val);
+    sendResponse(String(Q2));
+  }
+  else if (cmd == "R1") {
+    sendResponse(String(Q1));
+  }
+  else if (cmd == "R2") {
+    sendResponse(String(Q2));
+  }
+  else if (cmd == "SCAN") {
+    sendResponse(String(readTemperature(pinT1)));
+    sendResponse(String(readTemperature(pinT2)));
+    sendResponse(String(Q1));
+    sendResponse(String(Q2));
+  }
+  else if (cmd == "T1") {
+    sendResponse(String(readTemperature(pinT1)));
+  }
+  else if (cmd == "T2") {
+    sendResponse(String(readTemperature(pinT2)));
+  }
+  else if (cmd == "VER") {
+    sendResponse("TCLab Firmware " + vers + " " + boardType);
+  }
+  else if (cmd == "X") {
+    setHeater1(0);
+    setHeater2(0);
+    sendResponse("Stop");
+  }
+  else if (cmd.length() > 0) {
+    setHeater1(0);
+    setHeater2(0);
+    sendResponse(cmd);
+  }
+  Serial.flush();
+  cmd = "";
+}
+
+void checkAlarm(void) {
+  if ((readTemperature(pinT1) > limT1) or (readTemperature(pinT2) > limT2)) {
+    alarmStatus = 1;
+  }
+  else {
+    alarmStatus = 0;
+  }
+}
+
+void updateStatus(void) {
+  // determine led status
+  ledStatus = 1;
+  if ((Q1 > 0) or (Q2 > 0)) {
+    ledStatus = 2;
+  }
+  if (alarmStatus > 0) {
+    ledStatus += 2;
+  }
+  // update led depending on ledStatus
+  if (millis() < ledTimeout) {        // override led operation
+    analogWrite(pinLED1, LED);
+  }
+  else {
+    switch (ledStatus) {
+      case 1:  // normal operation, heaters off
+        analogWrite(pinLED1, loLED);
+        break;
+      case 2:  // normal operation, heater on
+        analogWrite(pinLED1, hiLED);
+        break;
+      case 3:  // high temperature alarm, heater off
+        if ((millis() % 2000) > 1000) {
+          analogWrite(pinLED1, loLED);
+        } else {
+          analogWrite(pinLED1, loLED/4);
+        }
+        break;
+      case 4:  // high temperature alarm, heater on
+        if ((millis() % 2000) > 1000) {
+          analogWrite(pinLED1, hiLED);
+        } else {
+          analogWrite(pinLED1, loLED);
+        }
+        break;
+    }
+  }
+}
+
+// set Heater 1
+void setHeater1(float qval) {
+  Q1 = max(0., min(qval, 100.));
+  analogWrite(pinQ1, (Q1*P1)/100);
+}
+
+// set Heater 2
+void setHeater2(float qval) {
+  Q2 = max(0., min(qval, 100.));
+  analogWrite(pinQ2, (Q2*P2)/100);
+}
+
+// arduino startup
+void setup() {
+  analogReference(EXTERNAL);
+  while (!Serial) {
+    ; // wait for serial port to connect.
+  }
+  Serial.begin(baud);
+  Serial.flush();
+  setHeater1(0);
+  setHeater2(0);
+  ledTimeout = millis() + 1000;
+}
+
+// arduino main event loop
+void loop() {
+  readCommand();
+  if (DEBUG) echoCommand();
+  parseCommand();
+  dispatchCommand();
+  checkAlarm();
+  updateStatus();
+}