Arnov Sharma
Published © MIT

Raspberry Pi 1000

Raspberry Pi 5-based all-in-one PC inside a keyboard!

BeginnerFull instructions provided1 hour29,019
Raspberry Pi 1000

Things used in this project

Hardware components

Raspberry Pi 5
Raspberry Pi 5
×1
Seeed Studio XIAO SAMD21 (Pre-Soldered) - Seeeduino XIAO
Seeed Studio XIAO SAMD21 (Pre-Soldered) - Seeeduino XIAO
×1

Software apps and online services

Fusion
Autodesk Fusion
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA

Story

Read more

Custom parts and enclosures

CAD FILE

CAD STEP FILE

Schematics

SCH

Code

code

C/C++
#include <HID-Project.h>                    //include HID_Project library
#include <HID-Settings.h>

#define REVERSED false                      //if your controller is reversed change it to true

int val = 0;
int previousval = 0;
int val2 = 0;

void setup() {
  Consumer.begin();                         //initialize computer connection
  delay(1000);                              //wait for computer to connect
  for(int a = 0; a < 52; a++) {
    Consumer.write(MEDIA_VOLUME_DOWN);      //set the volume to 0
    delay(2);
  }
}

void loop() {
  val = analogRead(D0);                      //read potentiometer value
  val = map(val, 0, 1023, 0, 101);          //map it to 102 steps
  if(REVERSED) {
    val = 101 - val;
  }
  if(abs(val - previousval) > 1) {          //check if potentiometer value has changed
    previousval = val;
    val /= 2;                               //divide it by 2 to get 51 steps
    while(val2 < val) {
      Consumer.write(MEDIA_VOLUME_UP);      //turn volume up to appropiate level
      val2++;
      delay(2);
    }
    while(val2 > val) {
      Consumer.write(MEDIA_VOLUME_DOWN);    //turn volume down to appropiate level
      val2--;
      delay(2);
    }
  }
  delay(301);                               //wait at least 300ms between changing volume levels
}                                           //if it will change faster Windows can sometimes 
                                            //increase or decrease volume by 10 steps at once

Credits

Arnov Sharma

Arnov Sharma

310 projects • 307 followers
Just your average MAKER

Comments