We are currently building the code. All the code posted here should be considered as BETA code. Please to not hesitate to make requests and suggestions.

 

The buzzer Code

int freq = 2000;
int channel = 0;
int resolution = 8;
  
void setup() {
  
  Serial.begin(115200);
  ledcSetup(channel, freq, resolution);
  ledcAttachPin(32, channel);
  
}
  
void loop() {
  
  ledcWriteTone(channel, 2000);
  
  for (int dutyCycle = 0; dutyCycle <= 255; dutyCycle=dutyCycle+10){
  
    Serial.println(dutyCycle);
  
    ledcWrite(channel, dutyCycle);
    delay(1000);
  }
  
  ledcWrite(channel, 125);
  
  for (int freq = 255; freq < 10000; freq = freq + 250){
  
     Serial.println(freq);
  
     ledcWriteTone(channel, freq);
     delay(1000);
  }
  
}

 

THE DISPLAY CODE

 

#include <bb_uc1701.h>

#define DC_PIN 12
#define CS_PIN 14
#define RST_PIN 15
#define MOSI_PIN 19
#define SCK_PIN 18
#define LED_PIN 27 
#define FLIP180 0
#define INVERT 0

// clock=*/ 18, /* data=*/ 19, /* cs=*/ 14, /* dc=*/ 12, /* reset=*/ 15 


void setup() {
  // put your setup code here, to run once:
   uc1701Init(DC_PIN, RST_PIN, LED_PIN, CS_PIN, MOSI_PIN, SCK_PIN, FLIP180, INVERT, -1);
   uc1701Fill(0);
   uc1701WriteString(0,0,(char *)"www.snaponair.com", 0, FONT_NORMAL);
}

void loop() {
  // put your main code here, to run repeatedly:


int i;
unsigned long ulTime;
char szTemp[32];

    ulTime = millis();
    for (i=0; i<50; i++)
    {
      uc1701Fill(0);
      uc1701Fill(0xff);
    }
    ulTime = millis() - ulTime;
    sprintf(szTemp, "time in ms = %d", (int)ulTime);
    uc1701WriteString(0,0,szTemp, 0, FONT_NORMAL);
    delay(4000);    

}

 

The ROTARY ENCODER Demo Code

#define CLK 33
#define DT 25
#define SW 26
int counter = 0;
int state;
int Laststate;

void setup() {
pinMode(CLK,INPUT);
pinMode(DT,INPUT);
pinMode(SW,INPUT);
Serial.begin(115200);

Laststate = digitalRead(CLK);
}

void loop() {
state = digitalRead(CLK);
if(state != Laststate)
{
if(digitalRead(DT) != state)
{
counter++;
//Serial.println(counter);
}
else
{
counter--;
//Serial.println(counter);
}

Serial.println(counter);
}

if(digitalRead(SW) != 1)
{
counter=0;
Serial.println(counter);
}

Laststate= state;

}

 

Button1 code

/*
* (c) 2020 Dr CADIC Philippe 
* Morpheans / SnaponAir
* Code to detect if a button1 (GPIO 34) has been pressed
*/

const int buttonPin = 34; // the number of the pushbutton pin
const int ledPin = 4; // the number of the LED pin
// variables will change:
int buttonState = 0; // variable for reading the pushbutton status
void setup() {
Serial.begin(9600);
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// Show the state of pushbutton on serial monitor
Serial.println(buttonState);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
} else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
// Added the delay so that we can see the output of button
delay(100);
}

Button 2 code

/*
 * (c) 2020 Dr CADIC Philippe 
 * Morpheans / SnaponAir
 * Code to detect if a button1 (GPIO 34) has been pressed
 */

const int buttonPin = 35;     // the number of the pushbutton pin
const int ledPin =  4;      // the number of the LED pin
// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status
void setup() {
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}
void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);
  // Show the state of pushbutton on serial monitor
  Serial.println(buttonState);
  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
  // Added the delay so that we can see the output of button
  delay(100);
}