初始化提交

This commit is contained in:
王立帮
2024-07-20 22:09:06 +08:00
commit c247dd07a6
6876 changed files with 2743096 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
/*
* This example shows how to read from a seesaw encoder module.
* The available encoder API is:
* int32_t getEncoderPosition();
int32_t getEncoderDelta();
void enableEncoderInterrupt();
void disableEncoderInterrupt();
void setEncoderPosition(int32_t pos);
*/
#include "Adafruit_seesaw.h"
Adafruit_seesaw ss;
void setup() {
Serial.begin(9600);
if(!ss.begin(0x36)){
Serial.println("ERROR!");
while(1);
}
else Serial.println("seesaw started");
}
void loop() {
Serial.println(ss.getEncoderPosition());
delay(400);
}

View File

@@ -0,0 +1,25 @@
/* this example fades an rgb led based on a read encoder position */
#include "Adafruit_seesaw.h"
Adafruit_seesaw ss;
void setup() {
Serial.begin(9600);
if(!ss.begin(0x36)){
Serial.println("ERROR!");
while(1);
}
else Serial.println("seesaw started");
// turn off red and green leds
ss.analogWrite(5, 255);
ss.analogWrite(6, 255);
}
void loop() {
uint32_t val = abs(ss.getEncoderPosition());
val = constrain(val*2, 0, 255);
ss.analogWrite(4, 255-val); //write to the led
delay(10);
}