├── arduino ├── README.md ├── dc_motor.ino ├── joystick.ino ├── remote.ino ├── lcd.ino ├── rotary_encoder.ino └── rfid.ino ├── README.md └── .gitignore /arduino/README.md: -------------------------------------------------------------------------------- 1 | # arduino 2 | Electricity and stuff... 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | I know a little bit about software. hardware on the other hand... 2 | 3 | I will try to track some pcb designs and all other electronics stuff here. 4 | -------------------------------------------------------------------------------- /arduino/dc_motor.ino: -------------------------------------------------------------------------------- 1 | int speedPin=5; 2 | int dir1=4; 3 | int dir2=3; 4 | int mSpeed=255; 5 | 6 | void setup() { 7 | pinMode(speedPin, OUTPUT); 8 | pinMode(dir1,OUTPUT); 9 | pinMode(dir2,OUTPUT); 10 | 11 | Serial.begin(96000); 12 | } 13 | 14 | void loop() { 15 | digitalWrite(dir1,HIGH); 16 | digitalWrite(dir2,LOW); 17 | analogWrite(speedPin,mSpeed); 18 | delay(2000); 19 | analogWrite(speedPin,0); 20 | delay(5000); 21 | } 22 | -------------------------------------------------------------------------------- /arduino/joystick.ino: -------------------------------------------------------------------------------- 1 | int Xpin=A0; 2 | int Ypin=A1; 3 | int Spin=2; 4 | int Xval; 5 | int Yval; 6 | int Sval; 7 | 8 | void setup() { 9 | Serial.begin(9600); 10 | pinMode(Xpin,INPUT); 11 | pinMode(Ypin,INPUT); 12 | pinMode(Spin,INPUT); 13 | digitalWrite(Spin, HIGH); 14 | } 15 | 16 | void loop() { 17 | Xval = analogRead(Xpin); 18 | Yval = analogRead(Ypin); 19 | Sval = digitalRead(Spin); 20 | delay(200); 21 | 22 | Serial.print(Xval); 23 | Serial.print(" "); 24 | Serial.print(Yval); 25 | Serial.print(" "); 26 | Serial.print(Sval); 27 | Serial.println(""); 28 | } 29 | -------------------------------------------------------------------------------- /arduino/remote.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int IRpin = 11; 4 | IRrecv IR(IRpin); 5 | decode_results cmd; 6 | 7 | int LPin = 12; 8 | 9 | int on = 0; 10 | 11 | void setup() { 12 | Serial.begin(9600); 13 | pinMode(LPin, OUTPUT); 14 | IR.enableIRIn(); 15 | } 16 | 17 | void loop() { 18 | 19 | while(IR.decode(&cmd) == 0) { 20 | 21 | } 22 | Serial.println(cmd.value); 23 | delay(500); 24 | if(cmd.value == 4105841032) { 25 | if(on == 1) { 26 | on = 0; 27 | } else { 28 | on = 1; 29 | } 30 | } 31 | 32 | if(on == 1) { 33 | digitalWrite(LPin, HIGH); 34 | } else { 35 | digitalWrite(LPin, LOW); 36 | } 37 | 38 | IR.resume(); 39 | } 40 | -------------------------------------------------------------------------------- /arduino/lcd.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int rs=7; 4 | int en=8; 5 | int d4=9; 6 | int d5=10; 7 | int d6=11; 8 | int d7=12; 9 | 10 | LiquidCrystal lcd(rs,en,d4,d5,d6,d7); 11 | 12 | void setup() { 13 | lcd.begin(16,2); 14 | } 15 | 16 | void loop() { 17 | lcd.setCursor(0,0); 18 | lcd.print("Mariam ist klein."); 19 | } 20 | -------------------------------------------------------------------------------- /arduino/rotary_encoder.ino: -------------------------------------------------------------------------------- 1 | // Rotary Encoder Inputs 2 | #define inputCLK 4 3 | #define inputDT 5 4 | 5 | // LED Outputs 6 | #define ledCW 8 7 | #define ledCCW 9 8 | 9 | int counter = 0; 10 | int currentStateCLK; 11 | int previousStateCLK; 12 | 13 | String encdir =""; 14 | 15 | void setup() { 16 | 17 | // Set encoder pins as inputs 18 | pinMode (inputCLK,INPUT); 19 | pinMode (inputDT,INPUT); 20 | 21 | // Set LED pins as outputs 22 | pinMode (ledCW,OUTPUT); 23 | pinMode (ledCCW,OUTPUT); 24 | 25 | // Setup Serial Monitor 26 | Serial.begin (9600); 27 | 28 | // Read the initial state of inputCLK 29 | // Assign to previousStateCLK variable 30 | previousStateCLK = digitalRead(inputCLK); 31 | 32 | } 33 | 34 | void loop() { 35 | 36 | // Read the current state of inputCLK 37 | currentStateCLK = digitalRead(inputCLK); 38 | 39 | // If the previous and the current state of the inputCLK are different then a pulse has occured 40 | if (currentStateCLK != previousStateCLK){ 41 | 42 | // If the inputDT state is different than the inputCLK state then 43 | // the encoder is rotating counterclockwise 44 | if (digitalRead(inputDT) != currentStateCLK) { 45 | counter --; 46 | encdir ="CCW"; 47 | digitalWrite(ledCW, LOW); 48 | digitalWrite(ledCCW, HIGH); 49 | 50 | } else { 51 | // Encoder is rotating clockwise 52 | counter ++; 53 | encdir ="CW"; 54 | digitalWrite(ledCW, HIGH); 55 | digitalWrite(ledCCW, LOW); 56 | 57 | } 58 | Serial.print("Direction: "); 59 | Serial.print(encdir); 60 | Serial.print(" -- Value: "); 61 | Serial.println(counter); 62 | } 63 | // Update previousStateCLK with the current state 64 | previousStateCLK = currentStateCLK; 65 | } 66 | -------------------------------------------------------------------------------- /arduino/rfid.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Typical pin layout used: 3 | * ----------------------------------------------------------------------------------------- 4 | * MFRC522 Arduino Arduino Arduino Arduino Arduino 5 | * Reader/PCD Uno/101 Mega Nano v3 Leonardo/Micro Pro Micro 6 | * Signal Pin Pin Pin Pin Pin Pin 7 | * ----------------------------------------------------------------------------------------- 8 | * RST/Reset RST 9 5 D9 RESET/ICSP-5 RST 9 | * SPI SS SDA(SS) 10 53 D10 10 10 10 | * SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16 11 | * SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14 12 | * SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | #define RST_PIN 9 // SPI Reset Pin 19 | #define SS_PIN 10 // SPI Slave Select Pin 20 | 21 | MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance 22 | 23 | void setup() { 24 | Serial.begin(9600); // Initialize serial communications with the PC 25 | while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4) 26 | SPI.begin(); // Init SPI bus 27 | mfrc522.PCD_Init(); // Init MFRC522 28 | delay(4); // Optional delay. Some board do need more time after init to be ready, see Readme 29 | mfrc522.PCD_DumpVersionToSerial(); // Show details of PCD - MFRC522 Card Reader details 30 | Serial.println(F("Scan PICC to see UID, SAK, type, and data blocks...")); 31 | } 32 | 33 | void loop() { 34 | // Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle. 35 | if ( ! mfrc522.PICC_IsNewCardPresent()) { 36 | return; 37 | } 38 | 39 | // Select one of the cards 40 | if ( ! mfrc522.PICC_ReadCardSerial()) { 41 | return; 42 | } 43 | 44 | // Dump debug info about the card; PICC_HaltA() is automatically called 45 | mfrc522.PICC_DumpToSerial(&(mfrc522.uid)); 46 | } 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | --------------------------------------------------------------------------------