_05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino 05_kidSerie

_05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino 05_kidSerie

/*
  Project name:
     05 #kidSerie - Adafruit-IO Meets ESP8266, Arduino & MIT App Inventor 2
     (Awesome Smart Phone App!)
     Flavour III -
     Hex File: _05_kidSerie_sketch_03.Adafruit_Fisrt_feeds.ino
   Revision History:
     20161029:
       - from github adafruit/Adafruit_MQTT_Library
  https://github.com/adafruit/Adafruit_MQTT_Library/blob/master/examples/mqtt_esp8266/mqtt_esp8266.ino
  https://learn.adafruit.com/mqtt-adafruit-io-and-you/intro-to-adafruit-mqtt

   Description:
     Code sequence to get the final flavor V. Follow, please!
     Simple code to intro Adafruit-io technology using MQTT broker, ESP8266, DHTXX sensor & arduino.
     We will publish two topics: temp and humidity and subscribe them also.
     We will access the our dashboard by phone using MIT App Inventor 2.
     Awesome project!!!

   MCU:                  Arduino 1.6.12 - @16MHz       http://www.arduino.cc/
   ESP8266:              ESP-01                        https://goo.gl/E0Eq4l
   DHT11:                PRODUCT ID: 386               https://www.adafruit.com/product/386

   Connections:
      See Official youtube channel vids:
   Based on:   Tony DiCola for Adafruit Industries - see below!

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License v3 as published by
   the Free Software Foundation
*/
/***************************************************
  Adafruit MQTT Library ESP8266 Example
  Must use ESP8266 Arduino from:
    https://github.com/esp8266/Arduino
  Works great with Adafruit's Huzzah ESP board & Feather
  ----> https://www.adafruit.com/product/2471
  ----> https://www.adafruit.com/products/2821
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!
  Written by Tony DiCola for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
 ****************************************************/
 /******************************* Adafruit MQTT *******************************/

#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"

/******************************* Esp8266**************************************/

#include <ESP8266WiFi.h>

/************************* WiFi Access Point *********************************/

#define WLAN_SSID       "colibri" //"...your SSID..."
#define WLAN_PASS       "jr10589238"//"...your password..."

/************************* Adafruit.io Setup *********************************/

#define AIO_SERVER      "io.adafruit.com"
#define AIO_SERVERPORT  1883                   // use 8883 for SSL
#define AIO_USERNAME    "giljr"// "...your AIO username (see https://accounts.adafruit.com)..."
#define AIO_KEY         "6dfe661db07e4b3cbd109d064c778e55" // "...your AIO key..."

/************ Global State (you don't need to change this!) ******************/

// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient client;
// or... use WiFiFlientSecure for SSL
//WiFiClientSecure client;

// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);

/****************************** Feeds ***************************************/
/****************************** Topics ***************************************/
// Setup a feed called 'photocell' for publishing.
// Notice MQTT paths for AIO follow the form: <username>/feeds/<feedname>
Adafruit_MQTT_Publish photocell = Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME "/feeds/photocell");
/****************************** Subscriptions*********************************/
// Setup a feed called 'photocell' for subscribing to changes.
Adafruit_MQTT_Subscribe photocell_subsc = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/photocell");

/***************************  MQTT Conn   ************************************/

// Bug workaround for Arduino 1.6.6, it seems to need a function declaration
// for some reason (only affects ESP8266, likely an arduino-builder bug).
void MQTT_connect();

/****************************** Setup  ***************************************/
void setup() {
  Serial.begin(115200);
  delay(10);

  Serial.println(F("Adafruit MQTT demo"));

  // Connect to WiFi access point.
  Serial.println(); Serial.println();
  Serial.print("Connecting to ");
  Serial.println(WLAN_SSID);

  WiFi.begin(WLAN_SSID, WLAN_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println();

  Serial.println("WiFi connected");
  Serial.println("IP address: "); Serial.println(WiFi.localIP());

  // Setup MQTT subscription for onoff feed.
  mqtt.subscribe(&photocell_subsc);
}

uint32_t x=0;    // Mock data

/****************************** Loop  ***************************************/
void loop() {
  // Ensure the connection to the MQTT server is alive (this will make the first
  // connection and automatically reconnect when disconnected).  See the MQTT_connect
  // function definition further below.
  MQTT_connect();

  // this is our 'wait for incoming subscription packets' busy subloop
  // try to spend your time here

 /****************************** Subscript  ***********************************/
 Adafruit_MQTT_Subscribe *subscription;
  while ((subscription = mqtt.readSubscription(5000))) {
    if (subscription == &photocell_subsc) {
      Serial.print(F("Got: "));
      Serial.println((char *)photocell_subsc.lastread);
    }
  }
 /****************************** Publish  **********************************/
   // Now we can publish stuff!
  Serial.print(F("\nSending photocell val "));
  Serial.print(x);
  Serial.print("...");
  if (! photocell.publish(x++)) {
    Serial.println(F("Failed"));
  } else {
    Serial.println(F("OK!"));
  }
/****************************** Ping  ***************************************/

  // ping the server to keep the mqtt connection alive
  // NOT required if you are publishing once every KEEPALIVE seconds
  /*
  if(! mqtt.ping()) {
    mqtt.disconnect();
  }
  */
}
/********************************* MQTT Conn  ********************************/
// Function to connect and reconnect as necessary to the MQTT server.
// Should be called in the loop function and it will take care if connecting.
void MQTT_connect() {
  int8_t ret;

  // Stop if already connected.
  if (mqtt.connected()) {
    return;
  }

  Serial.print("Connecting to MQTT... ");

  uint8_t retries = 3;
  while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
       Serial.println(mqtt.connectErrorString(ret));
       Serial.println("Retrying MQTT connection in 5 seconds...");
       mqtt.disconnect();
       delay(5000);  // wait 5 seconds
       retries--;
       if (retries == 0) {
         // basically die and wait for WDT to reset me
         while (1);
       }
  }
  Serial.println("MQTT Connected!");
}

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


Updated arduino Drivetrain

Updated arduino Drivetrain

  // 3 controllers
  //listed from front
  //controller1
  int controller1A1 = 13;
  int controller1A2 = 12;

  int controller1B1 = 11;
  int controller1B2 = 10;

  //controller2
  int controller2A1 = 9;
  int controller2A2 = 8;

  int controller2B1 = 7;
  int controller2B2 = 6;

  //controller3
  int controller3A1 = 5;
  int controller3A2 = 4;

  int controller3B1 = 3;
  int controller3B2 = 2;

  void setup(){
  // set all the motor control pins to outputs
  pinMode(controller1A1, OUTPUT);
  pinMode(controller1A2, OUTPUT);
  pinMode(controller1B1, OUTPUT);
  pinMode(controller1B2, OUTPUT);

  pinMode(controller2A1, OUTPUT);
  pinMode(controller2A2, OUTPUT);
  pinMode(controller2B1, OUTPUT);
  pinMode(controller2B2, OUTPUT);

  pinMode(controller3A1, OUTPUT);
  pinMode(controller3A2, OUTPUT);
  pinMode(controller3B1, OUTPUT);
  pinMode(controller3B2, OUTPUT);

  //NEED TO ASSIGN VALUES
  int frontRightMotor = 0;
  int frontLeftMotor = 0;
  int backRightMotor = 0;
  int backLeftMotor = 0;
  int middleMotor = 0;
  int pump = 0;

}
//
//dir is direction, vel is velocity, duration
//velocity is from 0 to 255
//direciton is 1 or -1
  void motorSpeed(int controller, int dir, int vel){

    if( dir = 1){
        analogWrite(controller, vel);
        analogWrite(controller, 0);
    }

    else{
        analogWrite(controller, 0);
        analogWrite(controller, vel);
    }

  }

void loop()
{
  //example code to make controller1A1 go forward at 200
  motorSpeed(controller1A1, 1, 200);

}

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


add servo test

add servo test

#include <Servo.h>

Servo latch;
int servopin = 8;

void setup()
{
  latch.attach(servopin);
}

void loop()
{
  latch.write(0);
  delay(10000);
  latch.write(180);
  delay(10000);
}

error: pathspec 'crypt-gears/servo_test/servo_test.ino' did not match any file(s) known to git


Timer for color coded LEDs changed

Timer for color coded LEDs changed

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


Added DigitalInputPullup example by Scott Fitzgerald

/*
 Input Pullup Serial

 This example demonstrates the use of pinMode(INPUT_PULLUP). It reads a
 digital input on pin 2 and prints the results to the serial monitor.

 The circuit:
 * Momentary switch attached from pin 2 to ground

 Unlike pinMode(INPUT), there is no pull-down resistor necessary. An internal
 20K-ohm resistor is pulled to 5V. This configuration causes the input to
 read HIGH when the switch is open, and LOW when it is closed.

 created 14 March 2012
 by Scott Fitzgerald

 This example code is in the public domain

 */

void setup(){
  //start serial connection
  Serial.begin(9600);
  //configure pin2 as an input and enable the internal pull-up resistor
  pinMode(2, INPUT_PULLUP);

}

void loop(){
  //read the pushbutton value into a variable
  int sensorVal = digitalRead(2);
  //print out the value of the pushbutton
  Serial.println(sensorVal);
  //brief delay
  delay(10);

}

error: pathspec 'build/shared/examples/2.Digital/DigitalIputPullup/DigitalIputPullup.ino' did not match any file(s) known to git


Adds first draft of Light Shield Arduino-side 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/jondolan/igvc-software.git/'


Added Arduino code

Added Arduino code

const int knockSensor = A0;
const int led = 13;
const int threshold = 10;

int sensorReading = 0;

void setup() {
  pinMode(led, OUTPUT);
  digitalWrite(led, HIGH);
  Serial.begin(9600);
  Serial.println("Nerf Target v0.0.1, github.com/mcoms/nerf-target, 2014.");
}

void loop() {
  sensorReading = analogRead(knockSensor);
  if (sensorReading > threshold) {
    String packet = String("NP,") + millis() + String(',') + sensorReading;
    Serial.println(packet);
    digitalWrite(led, LOW);
  }
  delay(100);
  digitalWrite(led, HIGH);
}

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


Added an example of using a thermistor to display temperature and activate two alarms: Hi and Low

/**************************************************************
 *
 *  Touchscreen_GUI_Template
 *
 *  Use this template as a starting point.
 *  The required libraries "includes" and configuration
 *  sample code is provided to help you quickly create
 *  a working sketch.
 *
 *  This library was developed for Seeedstudio
 *  TouchShield v2.0, based on their TFTv2 and SeeedTouchscreen
 *  libraries. This library is intended to provide a minimal
 *  but useful collection of reusable widgets that can be used
 *  to create a Graphical User Interface (GUI) for any Arduino
 *  project.
 *
 *  Comment out (or delete) lines that are not required for your project.
 *
 *  Author: Jose Rullan
 *	Release Date: 03/28/2015  -- Arduino Day 2015!!!
 *	Release Version: 0.1 beta
 *
 *	License: Whatever only requires to give credit to original
 *	author (i.e. Jose Rullan)
 *
 *	Credits:
 *
 *
 *************************************************************/

// Required includes
#include <SPI.h>
#include <math.h>

// TouchscreenGUI includes
#include <Button.h>
#include <Dial.h>
#include <Display.h>
#include <Gauge.h>
#include <Numkey.h>

// Create the objects
//==========================================
Canvas canvas = Canvas(); // Memory used: (storage/ram: 1,676/36)  3,372/228
Button button = Button(); // Memory used: (storage/ram: 3,624/63)  6,996/291
Dial dial = Dial();       // Memory used: (storage/ram: 4,760/64)  11756/355
Display disp = Display(); // Memory used: (storage/ram: 484/37)    12,240/392
Gauge gauge = Gauge();    // Memory used: (storage/ram: 1,470/52)  13710/444
Numkey numkey = Numkey(); // Memory used: (storage/ram: 2,370/59)  16,080/503
Button btnPlus = Button(20,GRAY1,BLACK,WHITE);	//Initialization version for round buttons
Button btnMinus = Button(20,GRAY1,BLACK,WHITE); //Initialization version for round buttons

// Global variables
// If you need global variables in your program put them here,
// before the setup() routine.
#define LED1 10
#define LED2 2

#define TMP_PIN A4
#define tempUpdate 5000

float tempF;
long lastUpdate;

void setup() {
  Serial.begin(9600);
  pinMode(LED1, OUTPUT);
  pinMode(LED2, OUTPUT);
  pinMode(7,OUTPUT);
  digitalWrite(7,HIGH);
  canvas.init(TFT_LANDSCAPE);

  //Configure the widgets
  //=========================================
    button.setSize(80,40);
    button.setColors(GRAY1,BLACK,WHITE);
    button.setText("Change");
    button.setEventHandler(&buttonEventHandler);
    button.init();
    button.setDebounce(100);

    btnPlus.setText("+");
    btnPlus.setEventHandler(&btnPlusEventHandler);
    btnPlus.init();
    btnPlus.setDebounce(100);

    btnMinus.setText("-");
    btnMinus.setEventHandler(&btnMinusEventHandler);
    btnMinus.init();
    btnMinus.setDebounce(100);

    dial.setSize(50);
    dial.setColors(GRAY2,YELLOW,GRAY1);
    dial.setLimits(60,80,100);
    dial.init();
    dial.setHiLimit(90,RED);
    dial.setLowLimit(75,BLUE);

    disp.setSize(80,40);
    disp.setColors(BLACK,GREEN,GRAY2);
    disp.setText("");
    disp.init();

    gauge.setSize(40,100);
    gauge.setColors(GRAY2,YELLOW,WHITE);
    gauge.setLimits(60,80,100);
    gauge.init();
    gauge.setHiLimit(90,RED);
    gauge.setLowLimit(75,BLUE);

    numkey.setSize(120,180);
    numkey.setColors(GRAY1,BLACK,WHITE);
    numkey.init();
    numkey.setNumkeyEventHandler(&numkeyEventHandler);
    numkey.setDebounce(100);

  // Add widgets to canvas
  // (Use layout template for coordinates)
  //=========================================
  canvas.add(&button,105,0);
  canvas.add(&dial,55,110);
  canvas.add(&disp,5,0);
  canvas.add(&gauge,110,60);
  canvas.add(&btnPlus,200,60);
  canvas.add(&btnMinus,200,120);

  //Numkey Notes:
  //The numkey widget is meant to be a pop-up
  //kind of widget. So it is added to the canvas
  //when it is required. Upon pressing the = sign
  //it will call it's event handler and after that
  //it will automatically be removed from the canvas.
  //To prevent this behavior then set
  //	numkey.isPopUp = false; (By default = true)
	//See buttonEventHandler below for an example.
  tempF = getTempF(TMP_PIN);
  dial.setCV((int) tempF);
  gauge.setCV((int) tempF);
  disp.setNum((int) tempF);
}

void loop() {
  float lastTemp = tempF;
  tempF = getTempF(TMP_PIN);
  if(tempF != lastTemp){
    if(millis()-lastUpdate > tempUpdate){
      dial.setCV((int) tempF);
      gauge.setCV((int) tempF);
      disp.setNum((int) tempF);
      if((unsigned int)tempF > dial.hiLimit){
        digitalWrite(LED2,HIGH);
      }else{
        digitalWrite(LED2,LOW);
      }
      if((unsigned int)tempF < dial.lowLimit){
        digitalWrite(LED1,HIGH);
      }else{
        digitalWrite(LED1,LOW);
      }
      lastUpdate = millis();
    }
  }
  canvas.scan();
}

// Event Handler Functions for buttons
//==========================================
void buttonEventHandler(Button* btn){
  // Example of a pop-up num keypad.
  // When button is pressed, the numkey
  // is added to the canvas, and it is rendered
  // automatically.
  canvas.add(&numkey,195,0);
}

void btnPlusEventHandler(Button* btn){
	gauge.setCV(gauge.getCV()+5);
	dial.setCV(gauge.getCV());
	disp.setNum(gauge.getCV());
}

void btnMinusEventHandler(Button* btn){
	if(gauge.getCV() < 5) return;
	gauge.setCV(gauge.getCV()-5);
	dial.setCV(gauge.getCV());
	disp.setNum(gauge.getCV());
}

void numkeyEventHandler(Numkey* nk){
	if(nk->getTextSize()>0){
		disp.setNum(nk->getNum());
		dial.setCV(nk->getNum());
		gauge.setCV(nk->getNum());
		nk->clear();
  }
}

float getTempC(int PIN){
  int a = analogRead(PIN);
  float resistance;
  int B = 3975; //thermistor constant

  resistance = (float) (1023-a)*10000/a;

  return 1/(log(resistance/10000)/B + 1/298.15) - 273.15;
}

float getTempF(int PIN){
  return getTempC(PIN)*9.0/5.0+32.0;
}

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


Adding a Cosa implementation of the NewLiquidCrystal library benchmarks.

/**
 * @file CosaLCDbench.ino
 * @version 1.0
 *
 * @section License
 * Copyright (C) 2013, Mikael Patel
 *
 * 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.
 *
 * @section Description
 * Benchmarking the LCD device drivers towards New LiquidCrystal
 * Library (https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/).
 * This is a Cosa version of performanceLCD.pde.
 *
 * This file is part of the Arduino Che Cosa project.
 */

#include "Cosa/RTC.hh"
#include "Cosa/Watchdog.hh"
#include "Cosa/Trace.hh"
#include "Cosa/LCD/Driver/HD44780.hh"

// Select the LCD port for the benchmark
// HD44780::Port port;
// HD44780::SR3W port;
HD44780::MJKDZ port;
// HD44780::DFRobot port;
HD44780 lcd(&port);

// Benchmarks
typedef void (*benchmark_t)(uint16_t);
void benchmark1(uint16_t nr);
void benchmark2(uint16_t nr);
void benchmark3(uint16_t nr);
void benchmark4(uint16_t nr);

// Measurement support
void measure(const char* name, benchmark_t fn, uint16_t nr, uint16_t bytes);
#define MEASURE(fn,bytes)						\
  do {									\
    measure(PSTR(#fn),fn,10,bytes);					\
    SLEEP(4);								\
  } while (0)

void setup()
{
  RTC::begin();
  Watchdog::begin();
  lcd.begin();
  trace.begin(&lcd, PSTR("CosaLCDbench: "));
  SLEEP(2);
}

// Display configuration
const uint16_t WIDTH = 16;
const uint16_t HEIGHT = 2;

void loop()
{
  MEASURE(benchmark1, WIDTH * HEIGHT + 2);
  MEASURE(benchmark2, WIDTH * HEIGHT * 6 * 2);
  MEASURE(benchmark3, WIDTH * HEIGHT + 2);
  MEASURE(benchmark4, WIDTH * HEIGHT + 2);
}

void benchmark1(uint16_t nr)
{
  while (nr--) {
    char c = ' ' + (nr & 0x1f);
    for (uint8_t height = 0; height < HEIGHT; height++) {
      lcd.set_cursor(0, height);
      for (uint8_t width = 0; width < WIDTH; width++)
	lcd.putchar(c);
    }
  }
}

void benchmark2(uint16_t nr)
{
  while (nr--) {
    for (uint8_t c = 'A'; c <= 'A' + 5; c++) {
      for (uint8_t height = 0; height < HEIGHT; height++) {
	for (uint8_t width = 0; width < WIDTH; width++) {
	  lcd.set_cursor(width, height);
	  lcd.putchar(c);
	}
      }
    }
  }
}

#define NUM_STR   "1234567890123456"
#define ALPHA_STR "ABCDEFGHIJKLMNOP"

void benchmark3(uint16_t nr)
{
  while (nr--) {
    lcd.set_cursor(0, 1);
    lcd.puts(NUM_STR);
    lcd.set_cursor(0, 1);
    lcd.puts(ALPHA_STR);
  }
}

void benchmark4(uint16_t nr)
{
  while (nr--) {
    lcd.set_cursor(0, 1);
    lcd.puts_P(PSTR(NUM_STR));
    lcd.set_cursor(0, 1);
    lcd.puts_P(PSTR(ALPHA_STR));
  }
}

void measure(const char* name, benchmark_t fn, uint16_t nr, uint16_t bytes)
{
  lcd.display_clear();
  lcd.puts_P(name);
  uint32_t start = RTC::micros();
  {
    fn(nr);
  }
  uint32_t us = (RTC::micros() - start) / nr;
  trace << clear << name << endl;
  trace << us << PSTR(" us (") << us / bytes << PSTR(")");
}

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


added MidiDemoPlayer.ino

added MidiDemoPlayer.ino

#include <SD.h>
#include <SPI.h>
#include <arduino.h>
#include <MusicPlayer.h>
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  player.beginInMidiFmt();
}

void loop() {
  // put your main code here, to run repeatedly:
  player.midiDemoPlayer();
  delay(500);
}

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


code borked

code borked

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/markwatneyy/ttt_arduino.git/'


arduino ds18b20 temp checker

arduino ds18b20 temp checker

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/wsnook/farm.git/'


Pince V3

Pince V3

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


Create sketch_onewire_DS18x20.ino

Create sketch_onewire_DS18x20.ino

/* One Wire - Example to Use

   We made the experiments with a Seeed Studio SEN08011P Temp Sensor
   the chip inside this sensor is the widely adopted DS18B20 product
   by Maxim/Dallas!

   Keep in Mind : The ds.search(addr) works like an iterator, if a
       device is found the address is put in the byte addr[8] var
       but the next time the method is call without the reset_search()
       the ds.search(addr) search for next device!

   See the README.md file for a brief reference to the functions of
   the OneWire library.

*/

// -------------------------- Library ---------------------------
// on pin 7 (a 4.7k resistor necessary if not Seeed Studio)
#include <OneWire.h>

// ---------------------------- Init ----------------------------
byte addr[8];
byte data[12];

int type_s = 0;
int i = 0;

OneWire ds(7);

// --------------------------- getChip --------------------------
void getChip(byte a[8]){
   // the first ROM byte indicates which chip
  switch (a[0]) {
    case 0x10:
      Serial.println("Chip : DS18S20");  // or old DS1820
      type_s = 1;
      break;
    case 0x28:
      Serial.println("Chip : DS18B20");
      type_s = 0;
      break;
    case 0x22:
      Serial.println("Chip : DS1822");
      type_s = 0;
      break;
    default:
      Serial.println("Device is not a DS18x20 family device.");

  }
}

// -------------------------- printAddr() ------------------------
void printAddr(byte ad[8]){
    Serial.print("Addr : ");
    for(i = 0; i < 8; i++){

        Serial.print(ad[i], HEX);
        Serial.print(" ");
    }
    Serial.println("");
}

// -------------------------- readData() ------------------------
void readData(){
   // start conversion, with parasite power on at the end
   ds.write(0x44, 1);
   // maybe 750ms is enough, maybe not
   delay(1000);

   // reset the 1-wire bus. needed before communicating with any device
   ds.reset();
   // select a device based on its address. After a reset, this is needed
   // to choose which device you will use, and then all communication will
   // be with that device, until another reset
   ds.select(addr);

   // read the Scratchpad
   ds.write(0xBE);

   Serial.print("Data : ");
   // read the 9 bytes of the Scratchpad (12 bytes with other models)
   for ( i = 0; i < 9; i++) {           // we need 9 bytes
      data[i] = ds.read();
      Serial.print(data[i], HEX);
      Serial.print(" ");
  }
  Serial.println("");

}

// ------------------------- printCRC() ------------------------
void printCRC(byte dta[12]){
    Serial.print("CRC  : ");
    Serial.print(OneWire::crc8(data, 8), HEX);
    Serial.println();
}

// -------------------------- getTemp() -------------------------
// convert : 16bit signed integer -> should be stored in init16_t
float getTemp(){
    int16_t raw = (data[1] << 8) | data[0];
  if (type_s) {
    raw = raw << 3; // 9 bit resolution default
    if (data[7] == 0x10) {
      // "count remain" gives full 12 bit resolution
      raw = (raw & 0xFFF0) + 12 - data[6];
    }
  } else {
    byte cfg = (data[4] & 0x60);
    // at lower res, the low bits are undefined, so let's zero them
    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
    //// default is 12 bit resolution, 750 ms conversion time
  }
   return (float)raw / 16.0;
}

// ------------------------- printTemp() ------------------------
void printTemp(){
    Serial.print("Temp : ");
    Serial.println(getTemp());
}

// --------------------------- SetUp ----------------------------
void setup() {
  // start the serial comm
  Serial.begin(9600);

}

// ---------------------------- Loop ----------------------------
void loop(void) {

  // Search next device, addr is an 8 byte array. device is found 1
  if(!ds.search(addr)){
      Serial.println("NO Address");
      ds.reset_search();
      delay(250);
  }else{
      Serial.println(" ");
      // print the Chip type
      getChip(addr);
      printAddr(addr);
      readData();
      printCRC(data);
      printTemp();

      // reset the addr
      ds.reset_search();
      delay(250);
  }

  delay(5000);
}

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


Create sensorflare-publish.ino

Create sensorflare-publish.ino

//Include the SensorFlare library
#include "sensorflare.h"

//Initialize objects from the library

//One object of the class "PWMOut" is initialized for
//every PWM output that will be remote control
SensorFlare::PWMOut pwm(A0);

//One object of the class "VarPublish" is initialized for every variable
//that will be published in order to access remotly from the cloud
//The argument that name the varible has a maximum of 12 characters
//Both methods initialized the variable that will be published as PUBLIC
SensorFlare::VarPublish varTem("temperature");
SensorFlare::VarPublish varPir("pir","PUBLIC");
//Initialized the variable that will be published as PRIVATE
SensorFlare::VarPublish varLight("light","PRIVATE");

// Initialize the different variables that will be used in the program
int tem_pin=A3;
int light_pin=A4;
int pir_pin=D0;
int status;
int new_status;
bool change;

void setup() {

// Call the begin() functions for every object of the classes "DigitalOut" and
//"PWMout" to be wired up correct and available.

    pwm.begin();

//Set the extra pins that are used on the program, but are not controlled remotely
    pinMode(pir_pin,INPUT);

}

void loop() {

    // Temperature sensor
    float tem= analogRead(tem_pin); // read value from the sensor
    // The returned value from the Core is going to be in the range from 0 to 4095
    // Calculate the voltage from the sensor reading
    float voltage = (tem * 3.3) / 4095;
    float deg =voltage* 100; // multiply by 100 to get degrees in K
    float temperature = deg - 273.15; // subtract absolute zero to get degrees Celsius

    //Luminosity
    float photocell= analogRead(light_pin); // read value from the sensor
    // The returned value from the Core is going to be in the range from 0 to 4095
    // Calculate the voltage from the sensor reading
    float Vphotocell = ((photocell * 3.3) / 4095);
    float rl=(Vphotocell*10)/(3.3-Vphotocell);//Photoresistor value in KΩ
    float value=500/rl;//luminosity
    int light= (int) value;

    //Find the change of state of the PIR sensor. Recognize move
    new_status=digitalRead(pir_pin);
    if (status!=new_status){
        status=new_status;
        change=TRUE;
    }

    //Publish every time that exist a change in the pin on which is connect the output of the PIR
    if (change==TRUE) {
        varPir.Publish(status,0);//Publish the variable at the called method time
        change=FALSE;
    }

    //Publish the variables every 15 seconds.
    varTem.Publish(temperature,15);
    varLight.Publish(light,15);

}

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


Add comment header.

Add comment header.

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/'


Needing to resolve memory issue

Needing to resolve memory issue

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/rniemand/ArduinoProjects.git/'


ThingSpeak IoT Weather Station

ThingSpeak IoT Weather Station

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/W4KRL/D1M-WX1-Weather-Station.git/'


Create mq2_arduino_to_serial.ino

Create mq2_arduino_to_serial.ino

const int gasPin = A0; //GAS sensor output pin to Arduino analog A0 pin
unsigned long time;

void setup()
{
	Serial.begin(9600); //Initialize serial port - 9600 bps
 pinMode(7, OUTPUT);
}

void loop()
{
  int valorgas = analogRead(gasPin);

	delay(1000); // Print value every 1 sec.

if (valorgas > 200 )

{digitalWrite(7, HIGH);}

else
{digitalWrite(7, LOW);}

if (millis() > (time + 5000)) {
       time = millis();
Serial.println(valorgas);
}
else {}

}

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


oops we should configure the motor drivers to the end …

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/trinamic/T-Bone.git/'


Create Arduino_OS_WeatherV26.ino

Create Arduino_OS_WeatherV26.ino

Arduino Uno (with a 433Mhz Rx) outputs a CSV file with data intercepted from an OS WMR86 Weather Station (Anemometer, Wind Direction, Temperature, Rainfall) plus on board digital Barometer and Humidity sensors

/*Status:  Yet another Oregon Scientific Weather Station 433Mhz Arduino Signal Intercepter
 *MIT Licence
 *Author: Rob Ward April 2014
 *Program Execution Summary-
 *Finds the header bits and synch's to the waveform's 1->0 going edges, which are '1's
 *Sweet spot for timing in this program is 240uS short pulse, 480uS long pulse, or thereabouts???
 *Soaks up rest of header bits and waits for first 0
 *Accumulates incoming data stream into bytes, arranged from MSB to LSB by rotating a mask in a Left Rotate
 *Checks for Sensor ID's, the ID's used here are relative to the previous way the data is collected, so not the same as other authors
 *Using the rotate bit on the fly the two ID bytes are as follows, this program just uses first byte to ID the sensor
 *        Oregon-THGN800   0xAF  	Outside Temp-Hygro    AF 82 ?? 4 ?? 1 (Sensor nybble 1,2or3)  10byte packet (9bytes used)
 *        Oregon-PCR800    0xA2 	Rain Gauge            A2 91 ?? 4 ?? 0                         11byte packet (11bytes used)
 *        Oregon-WGR800    0xA1 	Anemometer            A1 98 ?? 4 ?? 0                         10byte packet (10bytes used)
 *Rolling code 7bits is present to differentiate between alternative sensors, high bit set to 1 for 64 cycles means sensor is new.
 NB Rolling code ignored to ID the sensor as there are no other Oregon Scientifics around me and this avoids problems on sensor resets
 *Calculate the 8bit check sum of nybbles for the sensor and if data passes the test...continue  (2nybbles)
 *Decode the nybbles (if bites are bytes, nybbles are nybbles :-) and calculate the parameters for each sensor
 *On start up wait for a valid reading from each sensor and dump the calculations to the serial, round off to decimal places, every minute.

 Why not use interrrupts and count durations?  Manchester encoding came from the time of slow chips, noisey environments and saggy waveforms.
 The beauty of Manchester encoding is that it can be sampled so the 0V logic transitions are the most important and at least the logic
 state in the middle of the timing periods is most likely to be valid.  It also self synchronises throughout the packet and
 automatically detects timeouts.  This is an old, classic Manchester decoding decoding strategy, but quite robust never the less.
 Plus the Uno is only doing this task so no problem with it being in the foreground and chewing up most of the CPU cycles there.

 To do:
 *find the battery indicators if they exist. (7) suggests it is (my) upper 4 bits of byte[3].  How to fake old batteries??
 I put a 100ohm resistor across the terminals of the anemometer (in the springs) and chose some ordinary but OK batteries.
 I clipped it up and ran it for about 3 days.  After the first 24hr anemometer started to get get shaky and dropping readings
 However the byte[3]==4 all the time and did not change one bit.  I could not spot what bits if any were changing.
 I did the experiment at my son's house away from my system or it would have corrupted the "official anemometer" readings.
 A volt meter showed the voltage was dropping as expected but no clue discovered....

 Reference Material:
 Thanks to these authors, they all helped in some way, especially the last one Brian!!!!
 http://wmrx00.sourceforge.net/Arduino/OregonScientific-RF-Protocols.pdf (1)
 http://jeelabs.net/projects/cafe/wiki/Decoding_the_Oregon_Scientific_V2_protocol (2)
 https://github.com/phardy/WeatherStation (3)
 http://lucsmall.com/2012/04/27/weather-station-hacking-part-1/ (4)
 http://lucsmall.com/2012/04/29/weather-station-hacking-part-2/ (5)
 http://lucsmall.com/2012/04/29/weather-station-hacking-part-2/ (6)
 http://www.mattlary.com/2012/06/23/weather-station-project/(7)
 https://github.com/lucsmall/WH2-Weather-Sensor-Library-for-Arduino (8)
 http://www.lostbyte.com/Arduino-OSV3/ (9) brian@lostbyte.com

 Most of all thanks to Oregon Scientific, who have produced an affordable, high quality product.  I can now have my LCD Home Base in the
 kitchen to enjoy, with the Arduino in the garage also capturing data for WWW Weather pages.  Lovely!!!!  http://www.oregonscientific.com
 Very Highly recommended equipment. Rob Ward
 */
#include <Wire.h>
#include "DHT.h"
#include "Adafruit_BMP085.h"

#define DHTTYPE DHT22   // DHT 22  (AM2302)
#define DHTPIN 2     // what pin we're connected to

Adafruit_BMP085 bmp;
DHT dht(DHTPIN, DHTTYPE);

// Read data from 433MHz receiver on digital pin 8
#define RxPin 8            //Just an input
#define ledPin 13          //Human feedback
#define sDelay 230         //One Quarter Manchester Bit duration
#define lDelay 460         //One Half Manchester Bit duration
byte    headerHits=0;      //How many ones detected as a header bit
boolean header    = false; //State of header detection
boolean logic     = false; //State of the Manchester decoding
byte    signal    = 0;     //state of RF
boolean test230   = false;
boolean test460   = false;
int     maxBytes  = 11;    //sets the limits of how many data bytes will be required
int     nosBytes  = 0;     //counter for the data bytes required
boolean firstZero = false; //flags when the first '0' is found.
byte    dataByte  = 0;     //accumulates the bits of the signal
byte    dataMask  = 16;    //rotates left one bit for each Manchester bit received, so allows nybbles to be reversed on the fly
byte    nosBits   = 0;     //counts the shifted bits in the dataByte
byte    manchester[12];    //storage array for the data accumulated via manchester format
byte    battery   = 0;     // Indicator byte, merge battery details into this number
byte    quadrant  = 0;     //used to look up 16 positions around the compass rose
double  avWindspeed = 0.0;
double  gustWindspeed = 0.0; //now used for general anemometer readings rather than avWinspeed
float  rainTotal = 0.0;
float  rainRate  = 0.0;
double  temperature = 0.0;
int     humidity  = 0;
double  intTemp;
double  intHumi;
double  intPres;
int     scan=0; //On start up lower three bits used to show data from all sensors has been received before pooling and sending out data
byte    activity=0;//6 Bits, Flags whether good or bad checksum for a given sensor received in last minute
int     seconds;
const char windDir[16][4] = {
  "N  ", "NNE", "NE ", "ENE",  "E  ", "ESE", "SE ", "SSE",  "S  ", "SSW", "SW ", "WSW",  "W  ", "WNW", "NW ", "NNW"};

void setup(){
  Serial.begin(115200);
  //Serial.println("Robs V3.0 WMR86 Oregon Decoder");
  //Serial.print("Available Memory ");
  //Serial.println(availableMemory());
  pinMode(ledPin, OUTPUT);
  pinMode(RxPin, INPUT);
  digitalWrite(ledPin, HIGH);
  delay(100);//heart beat
  digitalWrite(ledPin, LOW);
  headerHits=0;

  //Tutorial on using the BMP05 Press/Temp transducer https://www.sparkfun.com/tutorials/253
  bmp.begin();    //start the barometer and temp packages

  // Initialize Timer1 for a 1 second interrupt
  // Thanks to http://www.engblaze.com/ for this section, see their Interrupt Tutorial
  cli();          // disable global interrupts
  TCCR1A = 0;     // set entire TCCR1A register to 0
  TCCR1B = 0;     // same for TCCR1B
  // set compare match register to desired timer count:
  OCR1A = 15624;
  // turn on CTC mode:
  TCCR1B |= (1 << WGM12);
  // Set CS10 and CS12 bits for 1024 prescaler:
  TCCR1B |= (1 << CS10);
  TCCR1B |= (1 << CS12);
  // enable timer compare interrupt:
  TIMSK1 |= (1 << OCIE1A);
  // enable global interrupts:
  sei();
}

//Routine Driven by Interrupt, trap 1 second interrupts, and output CSV every minute
ISR(TIMER1_COMPA_vect){
  seconds++;
  if (seconds == 60){//make 60 for each output
    seconds = 0;
    usbData();//comment this out to temporarily disable data every minute for debug
    activity=0;//just a number to check if all three Tx stations have been seen.
  }
} //end of interrupt routine

void loop(){
  //wait here for a header!!!
  // So far this appears as 'inverted' Manchester 1>0==1, 0>1==0 ??? (G. E. Thomas in 1949) http://en.wikipedia.org/wiki/Manchester_code
  while (header == false){
    while (digitalRead(RxPin)==1) { //Stay in loop while logic =1
      //loop while the RxPin==1, first half of bit pattern, just before data transition, 1 to 0
    }//exits when signal == 0, (1->0 falling edge found, transition to value 0) middle of bit pattern, ie the data edge
    delayMicroseconds(sDelay); //Short wait for a 1/4 of the "1" pattern
    if (digitalRead(RxPin) == 0){ //Check signal is still steady at 0 ( !0 = error detection)
      delayMicroseconds(lDelay); // long wait for next 1/2 of bit pattern,
      // ie now at 3/4 way through, looks like an ok bit "1" now keep track of how many in row we have detected
      if (digitalRead(RxPin) == 1){ // Check Rx polarity has now swapped, good!
        headerHits ++; // Highly likely a "1" waveform, so count it in
        //Serial.print(headerHits);
        //Serial.print(" ");
        if (headerHits == 20){ //if we can find 20 in a row we will assume it is a header
          header = true; //so we can exit this part, collect rest of header and begin data processing below
          headerHits=0; //reset, so ready to search for another header when next required, or should an error occur in this packet
          //Serial.println("");
          //Serial.print("H"); //uncomment to debug header detection
        }
      }
      else {
        headerHits=0;  // Has not followed the "1" wave pattern, probably badly formed, noisy waveform, so start again
        header=false; // make sure we look for another header
      }
    }
    else {
      headerHits=0;  // Has not followed wave pattern, probably just noise, so start again
      header=false; // make sure we look for another header
    }
  }

  //The program is now synch'ed to the '1' waveform and detecting the 1->0  "data" transitions in the bit waveform
  //The data byte boundaries indicate the Synch '0' is considered a part of the data, so byte boundary begins at that '0'
  logic=1; // look for rest of header 1's, these must be soaked up intil first 0 arrives to denote start of data
  signal=0; //RF Signal is at 0 after 1's 1->0 transition, inverted Manchester (see Wiki, it is a matter of opinion)
  firstZero=false; //The first zero is not immediately found, but is flagged when found

  while (header == true){
    //now get last of the header, and then store the data after trigger bit 0 arrives, and data train timing remains valid
    while (digitalRead(RxPin)!=signal){ //halt here while signal matches inverse of logic, if prev=1 wait for sig=0
    }//exits when signal==logic
    delayMicroseconds(sDelay); //wait for first 1/4 of a bit pulse
    test230 = digitalRead(RxPin);//snapshot of the input
    if ((test230 == signal)&&(nosBytes < maxBytes)){  //after a wait the signal level is the same, so all good, continue!
      delayMicroseconds(lDelay); //wait for second 1/2 of a bit pulse
      test460=digitalRead(RxPin);//snapshot of the input
      if (test230==test460){  // finds a long pulse, so the logic to look for will change, so flip the logic value
        //Assuming the manchester encoding, a long pulse means data flips, otherwise data stays the same
        logic = logic^1;
        signal = signal^1;
        //Serial.print(logic,BIN);  //debug data stream in binary
        if (!firstZero){ //if this is the first 0->1 data transition this is the sync 0
          digitalWrite(ledPin,1); //data processing begins, first though chew up remaining header
          firstZero = true; //flag that legit data has begun
          dataByte = B00000000; // set the byte as 1's (just reflects the header bit that have preceded the trigger bit=0)
          dataMask = B00010000; // set the byte as 1's (just reflects the header bit that have preceded the trigger bit=0)
          nosBits = 0;  // preset bit counter so we have 7 bits counted already
          //Serial.print("!");  //debug detection of first zero
        }
      }
      //data stream has been detected begin packing bits into bytes
      if (firstZero){
        if (logic){
          dataByte = dataByte | dataMask; //OR the data bit into the dataByte
        }
        dataMask = dataMask << 1;//rotate the data bit
        if (dataMask==0){
          dataMask=1;//make it roll around, is there a cleaner way than this? eg dataMask *=2?
        }
        nosBits++;
        if (nosBits == 8){ //one byte created, so move onto the next one
          manchester[nosBytes] = dataByte; //store this byte
          nosBits = 0;     //found 8, rezero and get another 8
          dataByte = 0;    //hold the bits in this one
          dataMask = 16;   //mask to do reversed nybbles on the fly
          nosBytes++;      //keep a track of how many bytes we have made
        }
      }
    }
    else {
      //non valid data found, or maxBytes equalled by nosBytes, reset all pointers and exit the while loop
      headerHits = 0;    // make sure header search begins again
      header = false;    // make sure we look for another header
      firstZero = false; // make sure we look for another 0->1 transition before processing incoming stream
      nosBytes = 0;      // either way, start again at beginning of the bank
    }

    //Temp has 10 bytes in packet, anemometer and rainfall have 11 bytes in packet
    if (manchester[0]==0xa2){
      maxBytes=11; //if looking for Temp then only collect 10 bytes
    }
    else{
      maxBytes=10; //if Anemometer or Rainfall then we must look for 11 bytes to include 2 byte Checksum at the end
    }
    //look for the required number of bytes and when reached process and check the data packet
    if (nosBytes == maxBytes){
      if (manchester[0]==0xaf){  //detected the Thermometer and Hygrometer
        //binBank();
        if(ValidCS(16)){
          //hexBank();
          scan = scan | 1;
          activity = activity | 1;    // indicate good CS detected
          thermom();
          //dumpThermom();
        }
        else{
          activity = activity | 16;  // indicate bad CS detected
        }
      }
      if (manchester[0]==0xa1){      //detected the Anemometer and Wind Direction
        if(ValidCS(18)){
          //binBank();
          scan = scan | 2;
          activity = activity | 2;   // indicate good CS detected
          anemom();
          //dumpAnemom();
        }
        else{
          activity = activity | 32;  // indicate bad CS detected
        }
      }
      if (manchester[0]==0xa2){      //detected the Rain Gauge
        if(ValidCS(19)){
          //hexBank();
          scan = scan | 4;
          activity = activity | 4;   // indicate good CS detected
          rain();
          //dumpRain();
        }
        else{
          activity = activity | 64;  // indicate bad CS detected
        }
      }
      headerHits = 0;                            //wind header bit hits back to 0
      header = false;                            //Look for a new header
      nosBytes =0;                               //reset byte pointer into bank
      intHumi=(double)dht.readHumidity();        //DHT22 readings %Humidity
      intTemp=(double)bmp.readTemperature();     //internal temperature
      intPres=(double)bmp.readPressure()/100.0;  //Pa reduced to mBar
    }
  }
  digitalWrite(ledPin,0); //data processing ends, look for another header
} //  End of main loop

// Formating routine for interface to host computer

void usbData(){
  // Stn Id, Packet Type, Wind Quadrant, Wind Speed, Rain Tips, Ext temp, Int Temp, Int Pressure, Int Humidity
  if (scan == 7){  //all readings now valid
    Serial.print(activity); // 03210321 Hi-Nybble flags failed Sensor Checksums, Lo-Nybble flags good failed Sensor Checksums
    Serial.print(",");
    Serial.print(battery);  // 00332211 Indicator battery level for sensors 1,2,3
    //Not sure what these bits mean, pretty sure so called battery bits are wrong, however an Indicator byte idea is an OK Idea
    //When and if the bits that indicate battery levels are found thye can go in here :-)
    //I have a suspicion they may use bad checksums or some such to detect when the Tx is getting low.  However that idea has a
    //weakness as any other Tx on 433 can scramble a packet, and each WMR86 has three Tx's all transmitting at different intervals
    //and will inevitably cause corrupted/bad packets when they overlap. Hence I have been monitoring checksums as well.
    Serial.print(",");
    Serial.print(quadrant);          //0-15 in 22.5 degrees steps clockwise
    Serial.print(",");
    Serial.print(gustWindspeed,1);   //Gust windspeed km/hr, not average windspeed
    Serial.print(",");
    Serial.print(rainTotal,1);       //yet to be checked for calibration mm
    Serial.print(",");
    Serial.print(temperature,2);     // OS Temperature Centigrade
    Serial.print(",");
    Serial.print(intTemp,2);         //BMP085 temperature (used for compensation reading) Centigrade
    Serial.print(",");
    Serial.print(intPres,2);         //BMP085 pressure reading milli-bars
    Serial.print(",");
    Serial.print(intHumi);           //Digital DHT22 seems better than the OS in Temp/Hum sensor % relative
    Serial.println();
  }
}

//Support Routines for Nybbles and CheckSum

// http://www.lostbyte.com/Arduino-OSV3/ (9) brian@lostbyte.com
// Directly lifted, then modified from Brian's work, due to nybbles bits now in correct order MSNybble->LSNybble
// CS = the sum of nybbles, 1 to (CSpos-1), compared to CSpos byte (LSNybble) and CSpos+1 byte (MSNybble);
// This sums the nybbles in the packet and creates a 1 byte number, and then compared to the two nybbles beginning at CSpos
// Note that Temp and anemometer uses only 10 bytes but rainfall use 11 bytes per packet. (Rainfall CS spans a byte boundary)
bool ValidCS(int CSPos){
  bool ok = false;
  byte cs = 0;
  for (int x=1; x<CSPos; x++){
    byte test=nyb(x);
    cs +=test;
  }
  byte check1 = nyb(CSPos);
  byte check2 = nyb(CSPos+1);
  byte check = (check2<<4)+check1;
  /*
  Serial.print(check1,HEX);  //dump out the LSNybble Checksum
   Serial.print("(LSB), ");
   Serial.print(check2,HEX);  //dump out the MSNybble Checksum
   Serial.print("(MSB), ");
   Serial.print(check,HEX);   //dump out the Rx'ed predicted byte Checksum
   Serial.print("(combined),  calculated = ");
   Serial.print(cs,HEX);      //dump out the calculated byte Checksum
   Serial.print("   ");       //Space it out for the next printout
   */
  if (cs == check){
    ok = true;
  }
  return ok;
}
// Get a nybble from manchester bytes, short name so equations elsewhere are neater :-)
byte nyb(int nybble){
  int bite = nybble / 2;       //DIV 2, find the byte
  int nybb  = nybble % 2;      //MOD 2  0=MSB 1=LSB
  byte b = manchester[bite];
  if (nybb == 0){
    b = (byte)((byte)(b) >> 4);
  }
  else{
    b = (byte)((byte)(b) & (byte)(0xf));
  }
  return b;
}

//Calculation Routines

/*   PCR800 Rain Gauge  Sample Data:
 //  0        1        2        3        4        5        6        7        8        9        A
 //  A2       91       40       50       93       39       33       31       10       08       02
 //  0   1    2   3    4   5    6   7    8   9    A   B    C   D    E   F    0   1    2   3    4   5
 //  10100010 10010001 01000000 01010000 10010011 00111001 00110011 00110001 00010000 00001000 00000010
 //  -------- -------  bbbb---  RRRRRRRR 88889999 AAAABBBB CCCCDDDD EEEEFFFF 00001111 2222CCCC cccc

 // byte(0)_byte(1) = Sensor ID?????
 // bbbb = Battery indicator??? (7)  My investigations on the anemometer would disagree here.
 // After exhaustive low battery tests these bbbb bits did not change
 // RRRRRRRR = Rolling Code Byte
 // 222211110000.FFFFEEEEDDDD = Total Rain Fall (inches)
 // CCCCBBBB.AAAA99998888 = Current Rain Rate (inches per hour)
 // ccccCCCC = 1 byte Checksum cf. sum of nybbles
 // Message length is 20 nybbles so working in inches
 Three tips caused the following
 1 tip=0.04 inches or 1.1mm (observed off the LCD)
 My experiment
 Personally I don't like this value I think mult by 25 (it was 42, then 31) and divide by 1000 should be closer to return mm directly.
 0.127mm per tip??? It looks close the above. Again can't vouch 100% for this, any rigorous assistance would be appreciated.
 */
void rain(){
  rainTotal = float(((nyb(18)*100000)+(nyb(17)*10000)+(nyb(16)*1000)+(nyb(15)*100)+(nyb(14)*10)+nyb(13))*25/1000.0);
  //Serial.println((nyb(18)*100000)+(nyb(17)*10000)+(nyb(16)*1000)+(nyb(15)*100)+(nyb(14)*10)+nyb(13),DEC);
  rainRate = float(((nyb(8)*10000)+(nyb(9)*1000)+(nyb(10)*100)+(nyb(11)*10)+nyb(12))*31.0/1000.0);
  //Serial.println((nyb(8)*10000)+(nyb(9)*1000)+(nyb(10)*100)+(nyb(11)*10)+nyb(12),DEC);
  battery  = (battery & B00111100)| (nyb(4)>>1);//lowest 2 bits in Indicator byte is for Rain bits (unproven conc?!?!)
}
void dumpRain(){
  Serial.print("Total Rain ");
  Serial.print(rainTotal);
  Serial.print(" mm, ");
  Serial.print("Rain Rate ");
  Serial.print(rainRate);
  Serial.println(" mm/hr ");
}

// WGR800 Wind speed sensor
// Sample Data:
// 0        1        2        3        4        5        6        7        8        9
// A1       98       40       8E       00       0C       70       04       00       34
// 0   1    2   3    4   5    6   7    8   9    A   B    C   D    E   F    0   1    2   3
// 10100001 10011000 01000000 10001110 00000000 00001100 01110000 00000100 00000000 00110100
// -------- -------- bbbb---- NRRRRRRR xxxx9999 xxxxxxxx CCCCDDDD xxxxFFFF 0000---- CCCCcccc
// Av Speed 0.4000000000m/s Gusts 0.7000000000m/s  Direction: N

// byte(0)_byte(1) = Sensor ID?????
// bbbb = Battery indicator??? (7)  My investigations would disagree here.  After exhaustive low battery tests these bits did not change
// NRRRRRRR = Rolling Code Byte, the N bit is set to 1 for 64 cycles to indicate it is reset or new to the Rx box
// 9999 = Direction
// DDDD.CCCC = Gust Speed (m per sec)
// 0000.FFFF = Avg Speed(m per sec)
// multiply by 3600/1000 for km/hr
// ccccCCCC = 1 byte checksum cf. sum of nybbles
// packet length is 20 nybbles

void anemom(){
  //D A1 98 40 8E 08 0C 60 04 00 A4
  avWindspeed = ((nyb(16)*10)+ nyb(15))*3.6/10;
  gustWindspeed =((nyb(13)*10)+nyb(12))*3.6/10;
  quadrant = nyb(9) & 0xF;
  battery  = (battery & B00110011)|(nyb(4)<<1);//Indicator middle 2 bits (bits 2&3) in byte is Anemometer (unproven data?!?!)
}
void dumpAnemom(){
  Serial.print("Av Speed ");
  Serial.print(avWindspeed);
  Serial.print(" km/hr, Gusts ");
  Serial.print(gustWindspeed);
  Serial.print(" km/hr, Direction: ");
  Serial.print(quadrant);
  Serial.print(" -> ");
  Serial.println(windDir[quadrant]);
}

// THGN800 Temperature and Humidity Sensor
// 0        1        2        3        4        5        6        7        8        9          Bytes
// 0   1    2   3    4   5    6   7    8   9    A   B    C   D    E   F    0   1    2   3      nybbles
// 01011111 00010100 01000001 01000000 10001100 10000000 00001100 10100000 10110100 01111001   Bits
// -------- -------- bbbbcccc RRRRRRRR 88889999 AAAABBBB SSSSDDDD EEEE---- CCCCcccc --------   Explanation
// byte(0)_byte(1) = Sensor ID?????
// bbbb = Battery indicator??? (7), My investigations on the anemometer would disagree here.  After exhaustive low battery tests these bits did not change
// RRRRRRRR = Rolling code byte
// nybble(5) is channel selector c (Switch on the sensor to allocate it a number)
// BBBBAAAA.99998888 Temperature in BCD
// SSSS sign for negative (- is !=0)
// EEEEDDDD Humidity in BCD
// ccccCCCC 1 byte checksum cf. sum of nybbles
// Packet length is 18 nybbles and indeterminate after that
// H 00 01 02 03 04 05 06 07 08 09    Byte Sequence
// D AF 82 41 CB 89 42 00 48 85 55    Real example
// Temperature 24.9799995422 degC Humidity 40.0000000000 % rel
void thermom(){
  temperature = (double)((nyb(11)*100)+(nyb(10)*10)+nyb(9))/10; //accuracy to 0.01 degree seems unlikely
  if(nyb(12)==1){//  Trigger a negative temperature
    temperature = -1.0*temperature;
  }
  humidity = (nyb(14)*10)+nyb(13);
  battery  = (battery & B00001111)|(nyb(4)<<3);//Indicator 2 bits (bits 4&5) in byte is Temperature  (unproven data?!?!)
}
void dumpThermom(){
  Serial.print("Temperature ");
  Serial.print(temperature);
  Serial.print(" degC, Humidity ");
  Serial.print(humidity);
  Serial.println("% Rel");
}

// Handy Debugging Routines

void binBank(){
  //Print the fully aligned binary data in manchester[] array
  Serial.println("D 00 00001111 01 22223333 02 44445555 03 66667777 04 88889999 05 AAAABBBB 06 CCCCDDDD 07 EEEEFFFF 08 00001111 90 22223333");
  Serial.print("D ");
  for( int i=0; i < maxBytes; i++){
    byte mask = B10000000;
    if (manchester[i]<16){
      Serial.print("0"); //pad single digit hex
    }
    Serial.print(manchester[i],HEX);
    Serial.print(" ");
    for (int k=0; k<8; k++){
      if (manchester[i] & mask){
        Serial.print("1");
      }
      else{
        Serial.print("0");
      }
      mask = mask >> 1;
    }
    Serial.print(" ");
  }
  Serial.println();
}

void hexBank(){
  //Print the fully aligned binary data, enable the headers if desired
  //Serial.println("H 00 01 02 03 04 05 06 07 08 09");
  //Serial.println("  00 00 00 00 00 00 00 00 11 11");
  //Serial.println("B 10 32 54 76 98 BA DC FE 10 32");
  Serial.print("D ");
  for( int i=0; i < maxBytes; i++){
    if (manchester[i]<16){
      Serial.print("0"); //pad single digit hex
    }
    Serial.print(manchester[i],HEX);
    Serial.print(" ");
  }
  Serial.println();
}

int availableMemory() {
  int size = 2048; //Arduino Uno, just keep an eye on this
  byte *buf;
  while ((buf = (byte *) malloc(--size)) == NULL);
  free(buf);
  return size;
}

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


16:41/30/08

int pin_1 = A0;     // potentiometer wiper
int pin_2 = A1;
int pin_3 = A2;
int val_1 = 0;
int val_2 = 0;
int val_3 = 0;
char userInput;
void setup()

{

  Serial.begin(9600);          //  setup serial

}

void loop(){
  if (Serial.available() > 0){
      userInput = Serial.read();
	 if (userInput == 'y'){
            val_1 = analogRead(pin_1);    // read the input pin
            val_2 = analogRead(pin_2);
            val_3 = analogRead(pin_3);
            int val[]={val_1,val_2,val_3};
            for (int i=0;i<=2;i++){
    	       Serial.println(val[i]);
	       }
           }
     }
}

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


Remove .ino from dropbo, make sure current local directory is the sketch folder so no unecessary nested folders created. Initial push of project

class Button
{
  protected:
    const uint8_t pin;
    const bool isToggleButton;
    uint16_t debounceDelay;

    bool defaultState; // not const because the state of the button on begin() is assumed to be the defaultState
    bool currentState;
    unsigned long lastTimePressed;
  public:
    // combination of Button(byte) and Button(byte, bool) and Button(byte, bool, int) constructors via default args
    Button(const uint8_t pin, const bool isToggleButton=false, uint16_t debounceDelay=500)
    : pin(pin), isToggleButton(isToggleButton) // const variables can only be assigned through initialization lists
                                               // (since they're supposed to be read-only)
    {
      this->debounceDelay = debounceDelay;
      lastTimePressed = 0;
    }
    void setDebounceDelay(int debounceDelay)
    {
      this->debounceDelay = debounceDelay;
    }

    bool pressed()
    {
      currentState = digitalRead(pin);
      if(currentState == !defaultState && (millis() - lastTimePressed > debounceDelay || isToggleButton == true))
      {
        lastTimePressed = millis();
        return true;
      }
      else
        return false;
    }
    void toggleWhenPressed(bool& condition)
    {
      if(isToggleButton)
        condition = digitalRead(pin);
      else if(pressed())
        condition = !condition;
    }
    bool held()
    {
      return digitalRead(pin) == !defaultState;
      // same behavior as pressed() for toggle buttons
    }

    //*** separated from constructor bc these functions need to be called in setup(), and object needs global scope
    virtual void begin()
    {
      pinMode(pin, INPUT);
      defaultState = digitalRead(pin);
      currentState = digitalRead(pin);
    }
};

class LEDButton : public Button
{
  private:
    const uint8_t ledOutPin;

    bool ledState;
  public:
    // call Button(int, int) constructor using constructor initialization list, setting inherited member data for you
    LEDButton(const uint8_t pin, const uint8_t ledOutPin, uint16_t debounceDelay=500) : Button(pin, false, debounceDelay), ledOutPin(ledOutPin)
    {
      //LED off by default
      ledState = LOW;
    }

    void ledOn()
    {
      ledState = HIGH;
      digitalWrite(ledOutPin, ledState);
    }
    void ledOff()
    {
      ledState = LOW;
      digitalWrite(ledOutPin, ledState);
    }
    void ledToggle()
    {
      ledState = !ledState;
      digitalWrite(ledOutPin, ledState);
    }

    void begin()
    {
      Button::begin();                      // call base class version of begin()
      pinMode(ledOutPin, OUTPUT);
      digitalWrite(ledOutPin, ledState);
    }
};

/*
Dremelfuge ETC Project 2015-2016
Adapted from Orlov's Instructable on Arduino Powered Centrifuge

Compiled and Edited by: Albert Ju, Fu Yang Chin
*/

#include <LiquidCrystal.h>               // include the library code for display

//---GLOBAL VARIABLES--//
//*** these variables MUST be global because they're being used by multiple totally separate functions--static local won't do
LiquidCrystal lcd = LiquidCrystal(12, 11, 5, 4, 3, 6);   // initialize the library with the numbers of the interface pins

// White Pushbutton
const uint8_t WPB_IN_PIN = 2, WPB_LED_PIN = 13;
const unsigned int WPB_DEBOUNCE_DELAY = 500;
LEDButton wpb = LEDButton(WPB_IN_PIN, WPB_LED_PIN, WPB_DEBOUNCE_DELAY);

// PWM (Pulse-Width Modulation) Motor Control and Potentiometer
const uint8_t MOTOR_PIN = 9;
const uint8_t POT_PIN = A5;

//*** No magic numbers! Using case statements, enum will provide readable, self-documenting code for when switching modes
enum class Mode
{
  SETTING_TIME,
  SETTING_SPEED,
  SPINNING
};
Mode mode = Mode::SETTING_TIME;                       //*** initialization over assignment; set SETTING_TIME to be the first mode!

//---Function prototypes---//
inline void lcdPrintFormattedSecs(unsigned long seconds);

void setup()
{
  const uint8_t LCD_COLUMNS = 20, LCD_ROWS = 4;

  wpb.begin();
  wpb.ledOn();

  pinMode(MOTOR_PIN, OUTPUT);
  pinMode(POT_PIN, INPUT);

  lcd.begin(LCD_COLUMNS, LCD_ROWS);
  lcd.setCursor(0, 0);
  lcd.print(F("  Dremel Centrifuge"));                //*** Serial or derived functions will store their String arguments in RAM, which is wasteful; F() stores them in flash memory, where the sketch is stored (largest storage)
  lcd.setCursor(0, 2);
  lcd.print(F("Set speed:"));
  lcd.setCursor(0, 3);
  lcd.print(F("   Push to Start!"));

  Serial.begin(9600);
}

void loop()
{
                                                      //*** static local variables--i.e. static variables inside of functions--are NOT STACK VARIABLES;
                                                      //    their values persist even after function ends, as long as the program is still running
                                                      //*** also, static local variables still only have local scope
                                                      //*** perform operations with data of the same type, so as to boost performance by not needing to typecast
  static unsigned long countdown;                     // the duration the centrifuge should run
  static unsigned long spinningStartTime;             // point on the timeline where the countdown starts, i.e. when wpb is pressed the second time
  static uint8_t motorSpeed;

  switch(mode)
  {
    case Mode::SETTING_TIME:
    {
      countdown = map(analogRead(POT_PIN), 0, 1024, 0, 901);

      lcd.setCursor(0, 1);
      lcd.print(F("Set time: <"));
      lcdPrintFormattedSecs(countdown);
      lcd.print(F(">   "));

      if(wpb.pressed())
      {
        // then implicitly set in stone the countdown value, change display, and enter next block
        //*** because mode will change, countdown will no longer be updated by pot, so on case switch countdown will equal its final value, no further updating necessary

        // Erase <> selector braces
        lcd.setCursor(10, 1);
        lcdPrintFormattedSecs(countdown);
        lcd.print(F("    "));

        countdown*= (long)1000;                       //*** to save space, the ATmega328P chip of UNO uses 2-byte ints, which can hold at max 32 767; operator*(int, int) will still return an int, but in this case an overflowed int;
                                                      //*** initSetTime, a long, will just be assigned the overflowed value--it won't force operator*(int, int) to return a long.
                                                      //*** so, by typecasting 1000 or using 1000L, you make the compiler promote analogRead() to a long, so operator*(long, long) will return the expected value, within range of sizeof long
        mode = Mode::SETTING_SPEED;
      }
      break;
    }

    case Mode::SETTING_SPEED:
    {
      motorSpeed = map(analogRead(POT_PIN), 0, 1024, 0, 255);

      lcd.setCursor(11, 2);
      lcd.print(F("<"));
      //map printing of motorSpeed to rpm range?!
      lcd.print(motorSpeed);
      lcd.print(F(">  "));

      if(wpb.pressed())
      {
        // then implicitly set in stone the motorSpeed value, change display, pre-start the countdown, and switch block

        // Erase <> selector braces
        lcd.setCursor(11, 2);
        lcd.print(motorSpeed);
        lcd.print(F("  "));

        spinningStartTime = millis();

        mode = Mode::SPINNING;
      }
      break;
    }

    case Mode::SPINNING:
    {
      unsigned long secondsLeft = (countdown - (millis() - spinningStartTime))/1000;  //*** save RAM AND flash memory by only doing this calculation once per case in loop()
      analogWrite(MOTOR_PIN, motorSpeed);

      lcd.setCursor(0, 1);
      lcd.print(F("Finished in: "));
      lcdPrintFormattedSecs(secondsLeft);
      lcd.print(F("  "));

      if(wpb.pressed() || secondsLeft == 0)
      {
        digitalWrite(MOTOR_PIN, LOW);
        mode = Mode::SETTING_TIME;
      }
      break;
    }
  }
}

inline void lcdPrintFormattedSecs(unsigned long seconds) //*** inline = suggestion to the compiler to paste the raw code of this function wherever it's called == performance optimization, no hopping pointers to callers and callbacks
{
  //***
  lcd.print(seconds/60); lcd.print(F(":")); lcd.print((seconds%60 < 10 ? F("0") : F(""))); lcd.print(seconds%60);
}


First version. Testing motor control.

First version. Testing motor control.

//Arduino PWM Speed Contro
short E1 = 5;
short M1 = 4;
short E2 = 6;
short M2 = 7;

short ST = 2;

signed int motorSpeed = 0;

#include <Wire.h>

void setup()
{
    Serial.begin(57600);
    Wire.begin();
    pinMode(M1, OUTPUT);
    pinMode(M2, OUTPUT);
    pinMode(E1, OUTPUT);
    pinMode(E2, OUTPUT);
    pinMode(ST, INPUT);
}

void loop()
{
  Serial.println("Hallo Welt!.");
  delay(3000);
  Serial.println("Calibrating...");
  delay(3000);
  Calibrate();
  Serial.println("Done.");
  while(true);
}

void Calibrate()
{
  for (short i = 0; i < 3; i++)
  {
  Serial.println("Going left...");
  if (digitalRead(ST) == HIGH)
  {
    SetMotorSpeed(-255);
    while(digitalRead(ST) == HIGH)
    {
      ;
    }
    SetMotorSpeed(0);
  }
  Serial.println("Going right...");
  SetMotorSpeed(200);
  while(digitalRead(ST) == LOW)
  {
    ;
  }
  }
  SetMotorSpeed(0);
}

void SetMotorSpeed(signed int motorSpeed)
{
  if (motorSpeed < 0)
  {
    digitalWrite(M1, HIGH);
  }
  else
  {
    digitalWrite(M1, LOW);
  }

  int ms = abs(motorSpeed);
  if (ms > 255)
  {
    ms = 255;
  }
  analogWrite(E1, ms);
}


Added file

Added file

/*************************************************************
Motor Shield 1-Channel DC Motor Demo
by Randy Sarafan

For more information see:
http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/

*************************************************************/
#include <Servo.h>

Servo VishalServo;

void setup() {
  Serial.begin(9600);
  Serial.println("SmartCar");
  //Setup Channel A
  pinMode(12, OUTPUT); //Initiates Motor Channel A pin
  pinMode(9, OUTPUT); //Initiates Brake Channel A pin

  //Setup Channel B
  pinMode(13, OUTPUT); //Initiates Motor Channel A pin
  pinMode(8, OUTPUT); //Initiates Brake Channel A pin
  VishalServo.attach(10);

  //This is for the led lamp
  //pinMode(6, OUTPUT);

  //VishalServo.writeMircoseconds(1500);
  Serial.println("Wait for 1 second");
  delay(1000);
  Serial.println("1=Forward");
  Serial.println("2=Backward");
  Serial.println("3=ForwardLeft");
  Serial.println("4=ForwardRight");
  Serial.println("5=Break");
  Serial.println("6=BackwardLeft");
  Serial.println("7=BackwardRight");
  Serial.println("8=360ClockSpinFlip");
  Serial.println("9=REVERSED360ClockSpinFlip");

}

void loop(){

  while(Serial.available()==0);
  int val = Serial.read()-'0';
  int i = VishalServo.read();

  //backward @ full speed
  if(val==2){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(12, HIGH); //Establishes backward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 123);   //Spins the motor on Channel A at full speed

  digitalWrite(13, LOW); //Establishes backward direction of Channel B
  digitalWrite(8, LOW);   //Disengage the Brake for Channel B
  analogWrite(11, 123);   //Spins the motor on Channel B at full speed

  delay(3000);
  }

  //This is for the break
  if(val==5){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  delay(1000);
  }

  //forward @ full speed
  if(val==1){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(12, LOW); //Establishes forward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 123);   //Spins the motor on Channel A at half speed

  digitalWrite(13, HIGH); //Establishes forward direction of Channel B
  digitalWrite(8, LOW);   //Disengage the Brake for Channel B
  analogWrite(11, 123);   //Spins the motor on Channel B at half speed

  delay(3000);
  }

  //This is for turning forward Left
  if(val==3){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(12, LOW); //Establishes Forward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 255);   //Spins the motor on Channel A at full speed

  }
  //This is for turning forward right

  if(val==4){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(13, HIGH); //Establishes Forward direction of Channel B
  digitalWrite(8, LOW);   //Disengage the Brake for Channel B
  analogWrite(11, 255);   //Spins the motor on Channel B at full speed
  }

  //This is for turning backward Left
  if(val==6){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(12, HIGH); //Establishes Backward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 255);   //Spins the motor on Channel A at full speed
  }
  //This is for turning backward Right
  if(val==7){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(13, LOW); //Establishes Backward direction of Channel A
  digitalWrite(8, LOW);   //Disengage the Brake for Channel A
  analogWrite(11, 255);   //Spins the motor on Channel A at full speed
  }
  //clockSpin360flip
  if(val==8){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(13, HIGH); //Establishes Forward direction of Channel b
  digitalWrite(8, LOW);   //Disengage the Brake for Channel b
  analogWrite(11, 255);   //Spins the motor on Channel b at full speed

  digitalWrite(12, HIGH); //Establishes backward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 255);   //Spins the motor on Channel A at full speed

}
  //ANTICLOCKSPIN360fli
  if(val==9){
  digitalWrite(9, HIGH); //Eengage the Brake for Channel A
  digitalWrite(8, HIGH); //Eengage the Brake for Channel B

  digitalWrite(13, LOW); //Establishes Backward direction of Channel b
  digitalWrite(8, LOW);   //Disengage the Brake for Channel b
  analogWrite(11, 255);   //Spins the motor on Channel b at full speed

  digitalWrite(12, LOW); //Establishes Forward direction of Channel A
  digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  analogWrite(3, 255);   //Spins the motor on Channel A at full speed

}

}
Arduino Motor Shield Tutorial
www.instructables.com

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


Added Gsr Script

Added Gsr Script

#include <eHealth.h>

extern volatile unsigned long timer0_overflow_count;
float fanalog0;
int analog0;
unsigned long time;
byte serialByte;

void setup() {
  Serial.begin(9600);
}

void loop() {
  while(1)
  {
    fanalog0=eHealth.getSkinConductance();
    Serial.println(fanalog0,5);
    delay(20);
  }
}

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


hmm, let's see if we can work with interrupts … no!


Skeleton code for smart meter tap (untested)

#include <Arduino.h>
#include <SoftwareSerial.h>

#define SERIAL_RX_PIN D5
#define BUFFER_SIZE_BYTES 64

SoftwareSerial p1(SERIAL_RX_PIN, -1, true, BUFFER_SIZE_BYTES);

void setup() {
  p1.begin(115200);

  Serial.begin(115200);
  Serial.println("Up and running");
}

void loop() {
  if (p1.available()) {
    int byte = p1.read();
    Serial.write(byte);
  }
}


Use a define instead of an in-function int.


Optimise data types

Optimise data types

fatal: remote error: upload-pack: not our ref 8294d4fe57c08e0f3964bb77032527c74777ca60
fatal: the remote end hung up unexpectedly


Added simple example.

Added simple example.

#include <EEPROM.h>
#include <EEWrap.h>

//Use the xxx_e types rather than the standard types like uint8_t
struct Foo{
  uint8_e a;
  int16_e b;
  float_e c;
};

Foo foo EEMEM; //EEMEM tells the compiler that the object resides in the EEPROM

void setup(){

  //Write to values stored in EEPROM
  foo.a = 45;
  foo.b = 12345;
  foo.c = 3.1415;

  //Print values from EEPROM
  Serial.begin(9600);
  Serial.println(foo.a);
  Serial.println(foo.b);
  Serial.println(foo.c);
}

void loop() {}

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


add a dot down script

add a dot down script

/*
from Adafrute I2C LED matrix8x8 example.
https://github.com/adafruit/Adafruit-LED-Backpack-Library
*/

/*
One LED light moves through (1,1) to (8,8),
*/

#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_8x8matrix matrix = Adafruit_8x8matrix ();

void setup ()
{
  matrix.begin (0x70);
  matrix.clear();
  matrix.writeDisplay();

}

 int col_row ;
 static const int lightdot = 128;
 // 128 == B100000000
 static const int none = 0;
 static const uint8_t PROGMEM
 mymap[] = {lightdot, none, none, none,
          none, none, none, none };

void loop()
{
 for(col_row = 0; col_row < 8; col_row++)
 {
    matrix.drawBitmap(col_row, col_row, mymap,
      col_row+1, col_row+1, LED_ON);
    matrix.writeDisplay();
    delay(500);
    matrix.clear();
    matrix.writeDisplay();
 }
}

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


Rename Example

Rename Example

#include <ParkingShield.h>

ParkingShield shield;

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
}

void loop()
{
  // Enables LEDs by Boolean expressions
  shield.setLed(ParkingShield::GREEN_LED,   shield.buttonS1Pressed() && !shield.buttonS2Pressed());
  shield.setLed(ParkingShield::YELLOW_LED, !shield.buttonS1Pressed() &&  shield.buttonS2Pressed());
  shield.setLed(ParkingShield::RED_LED,     shield.buttonS1Pressed() &&  shield.buttonS2Pressed());
}

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


initial push of ECS control sketch

initial push of ECS control sketch

#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <PubSubClient.h>

//Constants
#define SENSOR_ID "ECS"
#define PROBE_TEMPO 60000
#define ONE_WIRE_BUS D4  // DS18B20 pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

float oldTemp;

/************************* WiFi Access Point *********************************/

#define WLAN_SSID       "SFR_34A8"
#define WLAN_PASS       "ab4ingrograstanstorc"

/************************* MQTT *********************************/

const char* mqtt_server = "192.168.1.27";

/************ Global State (you don't need to change this!) ******************/

// Create an ESP8266 WiFiClient class to connect to the MQTT server.
WiFiClient espClient;
// or... use WiFiFlientSecure for SSL
//WiFiClientSecure client;

// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.
PubSubClient client(espClient);

long lastMsg = 0;
char msg[50];
int value = 0;

/****************************** Wifi connect function ***************************************/
void setup_wifi() {

  delay(10);
  // We start by connecting to a WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(WLAN_SSID);

  WiFi.begin(WLAN_SSID, WLAN_PASS);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  randomSeed(micros());

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void callback(char* topic, byte* payload, unsigned int length) {
  Serial.print("Message arrived [");
  Serial.print(topic);
  Serial.print("] ");
  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
  }
  Serial.println();

  // Switch on the LED if an 1 was received as first character
  if ((char)payload[0] == '1') {
    Serial.println("Ping received");
    String tmp_string = SENSOR_ID;
    tmp_string += "says : I'm alive!!!!";

    client.publish("connection_events", tmp_string.c_str());

  } else {
    Serial.println("doing nothing");

  }

}

void reconnect() {
  // Loop until we're reconnected
  while (!client.connected()) {
    Serial.print("Attempting MQTT connection...");
    // Create a random client ID
    String clientId = SENSOR_ID;

    // Attempt to connect
    if (client.connect(clientId.c_str())) {
      Serial.println("connected");
      // Once connected, publish an announcement...
      String connectMsg = "New connection from " + clientId;
      client.publish("connection_events", connectMsg.c_str());
      // ... and resubscribe
      String tmp_string = "ping";
      tmp_string += clientId;

      client.subscribe(tmp_string.c_str());
    }
    else {
      Serial.print("failed, rc=");
      Serial.print(client.state());
      Serial.println(" try again in 5 seconds");
      // Wait 5 seconds before retrying
      delay(5000);
    }
  }
}

void setup() {
  Serial.begin(115200);

  setup_wifi();
  client.setServer(mqtt_server, 1883);
  client.setCallback(callback);

}

void loop() {
  float temp;

  if (!client.connected()) {
    reconnect();
  }
  client.loop();

  long now = millis();

  if (now - lastMsg > PROBE_TEMPO) {
      lastMsg = now;

      //Read data and store it to variables hum and temp
      DS18B20.requestTemperatures();
      temp = DS18B20.getTempCByIndex(0);
      Serial.print("Temperature: ");
      Serial.println(temp);

      if (temp == 85.0 || temp == (-127.0)) {
          Serial.println("Failed to read from sensor!");
      }
      else
      {

          //send to MQTT server
          snprintf (msg, 75, "%.1f", temp);
          Serial.print("Publish message: ");
          Serial.println(msg);
          String outTopicPrefix = SENSOR_ID;
          String outTopicTemp = outTopicPrefix + "/temp";
          client.publish(outTopicTemp.c_str(), msg);

      }
  }

}

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


Add files via upload

Add files via upload

arduino patch to trigger heatpad

reimagining the mobile phone as a sensory device/PhoneTRigger/PhoneTRigger.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/invisibleFlock/holdprototypes.git/'


Adding the Arduino to cSound library

Adding the Arduino to cSound library

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


Just comments

Just comments

Commented program executor to know the sequence of actions

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/ivegotasthma/washmashine.git/'


arduino code

arduino 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/Sedatb23/SocialRobot.git/'


Create sensor_system.ino

Create sensor_system.ino

/*
 *
 * Authors: Jeffrey Leung, Charles Li, Mina Li, Paul Pinto
 * Last edited: 2016-03-19
 *
 * This Arduino sketch detects the activation of pressure pads by the presence
 * of an item and sends the result using Bluetooth communication to the
 * car system.
 *
 */

#include <SoftwareSerial.h>

const unsigned int pinPressureEssential = A0;
const unsigned int pinPressureGeneral = A1;
const unsigned int pinCapacitive = A2;

const unsigned int pinPressureEssentialPower = 7;
const unsigned int pinPressureGeneralPower = 6;
const unsigned int pinCapacitivePower = 5;

const unsigned int pinPowerLED = 13;
const unsigned int pinEssentialLED = 12;
const unsigned int pinGeneralLED = 11;

// Calibrated to the individual sensors
const unsigned int thresholdPressureEssential = 700;
const unsigned int thresholdPressureGeneral = 700;
const unsigned int thresholdCapacitive = 200;

// States
bool powerOn = true;
bool powerToggled = false;

static unsigned long minuteCounter;
unsigned long delay_hours;
unsigned long delay_minutes;

// Serial connections
SoftwareSerial serialCarSystem(2, 3);  // Pins 2, 3

// This method returns whether the given input pin reads greater than
// the given threshold.
bool SensorGreaterThan(const unsigned int pin, const unsigned int threshold) {
  return analogRead(pin) > threshold;
}

// This method counts down by a single minute when a minute has passed.
void MinuteSet() {
  if(minuteCounter < millis()) {

    if(delay_minutes == 0 && delay_hours > 0) {
      --delay_hours;
      delay_minutes = 59;
    }
    else if(delay_minutes > 0) {
      --delay_minutes;
    }

    minuteCounter = millis()+(60*1000);
  }
}

// This method sets a new delay time.
void SetDelayTime(const unsigned long hours, const unsigned long minutes) {
  delay_hours = hours;
  delay_minutes = minutes;
}

void setup() {
  Serial.begin(9600);
  serialCarSystem.begin(9600);

  // Pin outputs
  pinMode(pinPressureEssential, INPUT);
  pinMode(pinPressureGeneral, INPUT);

  pinMode(pinPressureEssentialPower, OUTPUT);
  pinMode(pinPressureGeneralPower, OUTPUT);
  pinMode(pinCapacitivePower, OUTPUT);
  digitalWrite(pinPressureEssentialPower, HIGH);
  digitalWrite(pinPressureGeneralPower, HIGH);
  digitalWrite(pinCapacitivePower, HIGH);

  pinMode(pinPowerLED, OUTPUT);
  pinMode(pinEssentialLED, OUTPUT);
  pinMode(pinGeneralLED, OUTPUT);
  digitalWrite(pinPowerLED, HIGH);
  digitalWrite(pinEssentialLED, LOW);
  digitalWrite(pinGeneralLED, LOW);

  minuteCounter = millis()+(60*1000);
}

void loop(){

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


Create PC_v099b0311.ino

Create PC_v099b0311.ino

error: pathspec 'Particle' did not match any file(s) known to git
error: pathspec 'Photon' did not match any file(s) known to git
error: pathspec 'based/code/PC_v099b0311.ino' did not match any file(s) known to git


Use atmega328p

Use atmega328p

#include <util/delay.h>
#include <avr/wdt.h>
#include <avr/sleep.h>    // Sleep Modes
#include <avr/power.h>    // Power management
#include <VirtualWire.h>

#define PWM_PIN 9 // TMP until dedicated chip arrives

#define VW_MAX_MESSAGE_LEN 40 // Same as solar/sensor
#define VW_RX_PIN 7 // PD7 (13)
#define RF_POWER_PIN 8 // PB0 (14) Toggle power to RF receiver

#define WD_DO_STUFF 1 // How many watchdog interupts before doing real work.

byte pwm_val = 127; // Temporary half value
volatile byte wd_isr = WD_DO_STUFF;

byte count = 10;

ISR(WDT_vect)
{
  // Wake up by watchdog
  if (wd_isr == 0) {
      wd_isr = WD_DO_STUFF;
  } else {
      --wd_isr;
      // Go back to sleep.
      goToSleep();
  }
}

void setup()
{
  // disable ADC
  ADCSRA = 0;

  // disable analog comparitor
  ACSR = (1 << ACD) | (0 << ACIE);

  watchdog_setup();
  pinMode(RF_POWER_PIN, OUTPUT);
  digitalWrite(RF_POWER_PIN, HIGH);

  pinMode(PWM_PIN, OUTPUT);  // TMP until dedicated chip arrives
  analogWrite(PWM_PIN, pwm_val);

  Serial.begin(9600);
  Serial.println("Setup");

  vw_set_rx_pin(VW_RX_PIN);
  vw_setup(2000);	 // Bits per sec
  vw_rx_start();       // Start the receiver running
}

void loop()
{
  --count;
  if (count == 0) {
    count = 10;
    goToSleep();
  }

  // Reset watchdog so he knows all is well.
  wdt_reset();

  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;

  if (vw_get_message(buf, &buflen)) { // Non-blocking
    int i;
    int val = 0;
    byte comma = 0;
    for (i = 0; i < buflen; i++) {

      if (buf[i] == 44) {
        // CSV - S,88,20.17,21.91,871,5595,5436
        // comma 5 = solar panel reading
        // comma 6 = battery reading

        if (comma == 5) {
          pwm_val = map(val, 0, 10000, 0, 255);
          analogWrite(PWM_PIN, pwm_val);

          // Print the solar reading
          //Serial.print(" pwm(");
          //Serial.print(pwm_val, DEC);
          //Serial.print(")");
        }

        ++comma;
        val = 0;
      }

      Serial.write(char(buf[i]));

      if (comma == 5 || comma == 6) {
        byte c = buf[i];
        // Only interested in numbers.
        // ASCII hex values 0x30 to 0x30 are decimal 0 to 9
        if (c > 0x2F && c < 0x3A) {
            if (val > 0) {
                // Expecting decimal numbers like 24,
                // so for each new argument multiply by ten.
                val *= 10;
                val += c - 0x30;
            } else {
                val = c - 0x30;
            }
            //Serial.print(val, DEC);
        }
      }

    }

    // Print the battery reading
    //Serial.print(" Bat(");
    //Serial.print(val, DEC);
    //Serial.print(")");

    Serial.println();

  }

  _delay_ms(500); // VERY TEMP
}

/**
 * Watchdog for while awake to ensure things are ticking over.
 */
void watchdog_setup()
{
  // Clear any previous watchdog interupt
  MCUSR = 0;

  // WD interrupt after 8 seconds,
  // unless wdt_reset(); has been successfully called

  /* In order to change WDE or the prescaler, we need to
   * set WDCE (This will allow updates for 4 clock cycles).
   */
  WDTCSR |= (1<<WDCE) | (1<<WDE);

  /* set new watchdog timeout prescaler value */
  WDTCSR = 1<<WDP0 | 1<<WDP3; // 8.0 seconds

  /* Enable the WD interrupt (note no reset). */
  WDTCSR |= _BV(WDIE);

  wdt_reset();
}

void goToSleep()
{

  // Turn off the RF receiver
  digitalWrite(RF_POWER_PIN, LOW);

  cli();

  // ensure ADC is off
  ADCSRA = 0;

  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  power_all_disable();

  // Power-down unused stuff - keep timer1 running for the pwm
  // off - timer0, USI, ADC
  //PRR = (0 << PRTIM1) | (1 << PRTIM0) | (1 << PRUSI) | (1 << PRADC);

  sleep_enable();
  sei();

  // turn off brown-out enable in software
  MCUCR = bit (BODS) | bit (BODSE);  // turn on brown-out enable select
  MCUCR = bit (BODS);        // this must be done within 4 clock cycles of above
  sleep_cpu();              // sleep within 3 clock cycles of above

  sleep_disable();
  MCUSR = 0; // clear the reset register

  power_all_enable();

  // Turn timer0 back on
  //PRR = (0 << PRTIM1) | (0 << PRTIM0) | (1 << PRUSI) | (1 << PRADC);

  // turn on the RF receiver
  digitalWrite(RF_POWER_PIN, HIGH);

}

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


Add a file to control sabertooth board

Add a file to control sabertooth board

// Software Serial Sample
// Copyright (c) 2012 Dimension Engineering LLC
// See license.txt for license details.

#include <SoftwareSerial.h>
#include <SabertoothSimplified.h>

SoftwareSerial SWSerial(NOT_A_PIN, 11); // RX on no pin (unused), TX on pin 11 (to S1).
SabertoothSimplified ST(SWSerial); // Use SWSerial as the serial port.

void setup()
{
  SWSerial.begin(9600);
}

void loop()
{
  int power;

  // Ramp from -127 to 127 (full reverse to full forward), waiting 20 ms (1/50th of a second) per value.
  for (power = -127; power <= 127; power ++)
  {
    ST.motor(1, power);
    delay(20);
  }

  // Now go back the way we came.
  for (power = 127; power >= -127; power --)
  {
    ST.motor(1, power);
    delay(20);
  }
}

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


Create ledblink.ino

Create ledblink.ino

/*
  Blink sketch for sFDW library
  Turns on an 4 LEDs on for one second in sequence,
  then off all at once, then on all at once, after on all at once,
  and turn off all 4 LEDs separately.
  And all this actions repeatedly.
  Functions of this library:
	- sPin(pin №, pin HIGH/LOW status <1/0> )
	- mPinsStateHigh(pins numbers for HIGH state switch, as array - separate by ",")
	- mPinsStateLow(pins numbers for LOW state switch, as array - separate by ",")
  Created by Dmitry Pogudo-Georgov, December 3, 2014.
  This example code is in the public domain.
 */

// Pins 6,7,8,9 has an LEDs connected on most Arduino boards.
#include <sFDW.h>

// the setup routine runs once when you press reset:
void setup() {}

// the loop routine runs over and over again forever:
void loop() {
  sFDW.sPin(6,1);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  sFDW.sPin(7,1);
  delay(1000);
  sFDW.sPin(8,1);
  delay(1000);
  sFDW.sPin(9,1);
  delay(1000);

  sFDW.mPinsStateLow(6,7,8,9);  // turn the LED off by making the voltage LOW in all ours pins
  delay(1000);                  // wait for a second

  sFDW.mPinsStateHigh(6,7,8,9); // turn the LED on by making the voltage HIGH in all ours pins
  delay(1000);                  // wait for a second

  sFDW.sPin(6,0);   // turn the LED off (LOW is the voltage level)
  delay(1000);               // wait for a second
  sFDW.sPin(7,0);
  delay(1000);
  sFDW.sPin(8,0);
  delay(1000);
  sFDW.sPin(9,0);
  delay(1000);

}

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


Let's get this small-commits thing right! Now we're sending our actual expected payload.

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/hooroo/moteino_build_lights.git/'


Added a simple example that sets accelerometer based on LED

/*
  Led from Acceleromter.

  Read the accelerometer every half second.
  Set the LED to something based on what we read.
  */

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 57600 bits per second:
  Serial.begin(57600);
}

// the loop routine runs over and over again forever:
void loop() {
    LED_SETTING_T setting = {0, 0, 0};
    ACC_READING_T accel = {0, 0, 0};

    if(Serial.accelRead(&accel) != 0){
     //Serial.print("Error reading\n");
    }
    else {
       // 0 -> 2400 / 10 == range of 0 -> 240. Pretty good for our LED
       setting.red = (accel.xAxis + 1200) / 10;
       setting.green = (accel.yAxis + 1200) / 10;
       setting.blue = (accel.zAxis + 1200) / 10;
       Serial.ledSet(setting);
    }

    delay(500);
}

error: pathspec 'examples/LightBlueBean/01.Basics/SettingLEDFromAccelerometer/SettingLEDFromAccelerometer.ino' did not match any file(s) known to git


chaos

chaos

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/trinamic/T-Bone.git/'


Update btSerial.ino

Update btSerial.ino

error: pathspec 'source/bluetooth' did not match any file(s) known to git
error: pathspec 'customization/btSerial.ino' did not match any file(s) known to git


okay

okay

the poscomp was also not buffered


update

update

  #include <CapacitiveSensor.h>

//Buttons
int numbts = 10;
int bts[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 16};
boolean bgates[10];
//Capacitive Sensors
int numcps = 2;
//CapacitiveSensor cps[] = {CapacitiveSensor(21, 14), CapacitiveSensor(21, 15), CapacitiveSensor(21, 18), CapacitiveSensor(21, 19), CapacitiveSensor(21, 20)};
CapacitiveSensor cps[] = {CapacitiveSensor(21, 14), CapacitiveSensor(21, 15)};
//CapacitiveSensor cps[] = {CapacitiveSensor(21, 14)};
boolean cpsgates[2];
long cpsval[2];
void setup() {
  Serial.begin(9600);
  for (int i = 0; i < numbts; i++) pinMode(bts[i], INPUT_PULLUP);
  for (int i = 0; i < numbts; i++) bgates[i] = false;
  for (int i = 0; i < numcps; i++) cpsgates[i] = true;
}

void loop() {
  //buttons
  for (int i = 0; i < numbts; i++) {
    if (!bgates[i]) {
      if (digitalRead(bts[i]) == LOW) {
        bgates[i] = true;
        Serial.print("bt" + String(i) + ":");
        Serial.println(1, DEC);
      }
    }
    if (bgates[i]) {
      if (digitalRead(bts[i]) == HIGH) {
        bgates[i] = false;
        Serial.print("bt" + String(i) + ":");
        Serial.println(0, DEC);
      }
    }
  }
  //Capacitive Sensors
 //long val = cps[0].capacitiveSensor(30);
 // Serial.println(val);
  for (int i = 0; i < numcps; i++) {
    cpsval[i] = cps[i].capacitiveSensor(30);
    if (cpsval[i] >= 4000) {
      if (cpsgates[i]) {
        cpsgates[i] = false;
        Serial.print("cs" + String(i) + ":");
        Serial.println(1, DEC);
      }
    }
    else if (cpsval[i] < 3000) {
      if (!cpsgates[i]) {
        cpsgates[i] = true;
        Serial.print("cs" + String(i) + ":");
        Serial.println(0, DEC);
      }
    }
  }

  delay(15);
}

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


strip initialization

strip initialization

/* Initialization Code for the Dorm LED System */

void set_pin_modes() {
  pinMode(STRIP_PIN_W1, OUTPUT);
  pinMode(STRIP_PIN_W2, OUTPUT);
  pinMode(STRIP_PIN_W3, OUTPUT);
  pinMode(STRIP_PIN_D1, OUTPUT);
  pinMode(STRIP_PIN_D2, OUTPUT);
}

void init_strips() {
  // Window Strips
  window1.begin();
  window1.show();

  window2.begin();
  window2.show();

  window3.begin();
  window3.show();

  // Desk Strips
  desk1.begin();
  desk1.show();

  desk2.begin();
  desk2.show();
}

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


Added RQ_SET_VALUE and RQ_SET_MODE commands.

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