Commit 73645b48 authored by yuichitamiya's avatar yuichitamiya
Browse files

workshop kamei

parent ae7b437c
Pipeline #243826 passed with stage
in 55 seconds
#include <Adafruit_FreeTouch.h>
Adafruit_FreeTouch qt_0 = Adafruit_FreeTouch(A0, OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE);
#include <TinyUSB_Mouse_and_Keyboard.h>
void setup() {
Keyboard.begin();
Serial.begin(115200);
qt_0.begin();
}
int qt_Threshold = 850;
void loop() {
int qt0 = 0;
qt0 = qt_0.measure();
if (qt0 >= qt_Threshold) {
Serial.print("qt0: "); Serial.println(qt0);
Key2_act();
}
//delay(100);
}
void Key2_act() {
// shut down window
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.write('w');
Keyboard.releaseAll();
KeyRelease();
}
void KeyRelease() {
Keyboard.releaseAll();
delay(500);
digitalWrite(LED_BUILTIN, HIGH);// XIAO HIGH = Off
}
/*Example
Keyboard.write('a'); //press and release 'a' key
uint8_t Multiple[3]= {'1','2','3'};
Keyboard.write(Multiple,3); //multiple keys sequentially from a buffer
Keyboard.print("456"); //print a string
Keyboard.println("789"); //print another string with a line
Keyboard.press(KEY_LEFT_SHIFT); //hold down the shift
Keyboard.println("a uppercase sentence"); //this will be all caps
Keyboard.release(KEY_LEFT_SHIFT);//release the shift
Keyboard.println ("back to lowercase");
Keyboard.press(KEY_LEFT_SHIFT); //press shift
Keyboard.println("1234"); //some text
Keyboard.releaseAll(); //release all
Keyboard.println("1234"); //not shifted
Keyboard.print("A mistake"); //will attempt to erase this
delay(1000);
Keyboard.press(KEY_LEFT_CTRL); //will attempt control-z
Keyboard.write('z');
Keyboard.releaseAll(); //release the control key
*/
#include <Adafruit_FreeTouch.h>
Adafruit_FreeTouch qt_0 = Adafruit_FreeTouch(A0, OVERSAMPLE_4, RESISTOR_50K, FREQ_MODE_NONE);
#include <TinyUSB_Mouse_and_Keyboard.h>
void setup() {
Keyboard.begin();
Serial.begin(115200);
qt_0.begin();
}
int qt_Threshold = 850;
void loop() {
int qt0 = 0;
qt0 = qt_0.measure();
if (qt0 >= qt_Threshold) {
Serial.print("qt0: "); Serial.println(qt0);
Key2_act();
}
//delay(100);
}
void Key2_act() {
// play/pause on youtube
Keyboard.write('k');
Keyboard.releaseAll();
KeyRelease();
}
void KeyRelease() {
Keyboard.releaseAll();
delay(500);
digitalWrite(LED_BUILTIN, HIGH);// XIAO HIGH = Off
}
/*Example
Keyboard.write('a'); //press and release 'a' key
uint8_t Multiple[3]= {'1','2','3'};
Keyboard.write(Multiple,3); //multiple keys sequentially from a buffer
Keyboard.print("456"); //print a string
Keyboard.println("789"); //print another string with a line
Keyboard.press(KEY_LEFT_SHIFT); //hold down the shift
Keyboard.println("a uppercase sentence"); //this will be all caps
Keyboard.release(KEY_LEFT_SHIFT);//release the shift
Keyboard.println ("back to lowercase");
Keyboard.press(KEY_LEFT_SHIFT); //press shift
Keyboard.println("1234"); //some text
Keyboard.releaseAll(); //release all
Keyboard.println("1234"); //not shifted
Keyboard.print("A mistake"); //will attempt to erase this
delay(1000);
Keyboard.press(KEY_LEFT_CTRL); //will attempt control-z
Keyboard.write('z');
Keyboard.releaseAll(); //release the control key
*/
......@@ -359,3 +359,52 @@ char ctrlKey = KEY_LEFT_GUI;
Keyboard.press(ctrlKey);
```
## Examples
### Footkey
<video width="640" controls>
<source src=".././images/workshop_examples/homma/footkey.MP4" type="video/mp4">
</video>
[video](./images/workshop_examples/homma/footkey.MP4)
[code](./images/workshop_examples/homma/xiao_qtouch_footkey2.ino)
### Vegetable Organ
<video width="640" controls>
<source src=".././images/workshop_examples/ishimura/vege_organ.mp4" type="video/mp4">
</video>
[video](./images/workshop_examples/ishimura/vege_organ.mp4)
[code](./images/workshop_examples/ishimura/Fab16_xiao_project_organ.ino)
### Posture Correcting Chair
<video width="640" controls>
<source src=".././images/workshop_examples/kamei/Posture_Correcting_Chair.MP4" type="video/mp4">
</video>
[video](./images/workshop_examples/kamei/Posture_Correcting_Chair.MP4)
[code](./images/workshop_examples/kamei/0805xiao_meanchair.ino)
### Singing Leaf
<video width="640" controls>
<source src=".././images/workshop_examples/kamei/Singing_Leaf.MP4" type="video/mp4">
</video>
[video](./images/workshop_examples/kamei/Singing_Leaf.MP4)
[code](./images/workshop_examples/kamei/0805xiao_singingleaf.ino)
<!--
How To Rotate Videos Using FFMpeg From Commandline
https://ostechnix.com/how-to-rotate-videos-using-ffmpeg-from-commandline/
$ ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
0 - Rotate by 90 degrees counter-clockwise and flip vertically. This is the default.
1 - Rotate by 90 degrees clockwise.
2 - Rotate by 90 degrees counter-clockwise.
3 - Rotate by 90 degrees clockwise and flip vertically.
-->
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment