-
Datei
GasAlarm.ino
/*Smoke Sensor MQ7 mit LCD Display connect the MQ2 sensor as follows : VCC >>> 5V AD0 >>> A0 GND >>> GND Contribution: epierre Based on http://sandboxelectronics.com/?p=165 License: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) */ #include <LiquidCrystal.h> //Sample using LiquidCrystal library LiquidCrystal lcd(12, 11, 10, 7, 6, 5, 4); // select the pins used on the LCD panel #define CHILD_ID_MQ 0 /************************Hardware Related Macros************************************/ #define MQ_SENSOR_ANALOG_PIN (0) //define which analog input channel you are going to use #define RL_VALUE
-
Datei
GasAlarm.ino
/*Smoke Sensor MQ7 mit LCD Display connect the MQ2 sensor as follows : VCC >>> 5V AD0 >>> A0 GND >>> GND Contribution: epierre Based on http://sandboxelectronics.com/?p=165 License: Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) */ #include <LiquidCrystal.h> //Sample using LiquidCrystal library LiquidCrystal lcd(12, 11, 10, 7, 6, 5, 4); // select the pins used on the LCD panel #define CHILD_ID_MQ 0 /************************Hardware Related Macros************************************/ #define MQ_SENSOR_ANALOG_PIN (0) //define which analog input channel you are going to use #define RL_VALUE
in „Platinen bei Smart Prototyping durchkontaktiert?“ · Platinen ·
-
Datei
Hauptprogramm_01.ino
/* * Kinderwagen mit E-Antrieb * Version 1.0 * * 17.03.2017 * * Treibt zwei DC-12V-Motoren mittels PWM an. * Das Ganze wird über einen Joystick (ADC) gesteuert oder * mittels Bluetooth-Modul und Schalter ("Remote-Control ON/OFF") * via Handy-App gesteuert. * Details siehe Schaltplan... * */ #define BAUDRATE 9600 #define BRAKEVCC 0 #define CLOCKWISE 1 // Clockwise (im Uhrzeigersinn) #define COUNTERCLOCKWISE 2 // Counterclockwise (gegen den Uhrzeigersinn) #define BRAKEGND 3 #define CS_THRESHOLD 15 // Safety current #define CLOCKWISE_MOTOR_0 9 // Pin am Arduino, der die Drehrichtung von Motor_0 im
in „Seltsames Verhalten - Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Funktionierender_Sketch.ino
#include <Adafruit_GFX.h> // Core graphics library #include <MCUFRIEND_kbv.h> MCUFRIEND_kbv tft; // hard-wired for UNO shields anyway. #include <TouchScreen.h> #if defined(__SAM3X8E__) #undef __FlashStringHelper::F(string_literal) #define F(string_literal) string_literal #endif uint8_t YP = A1; // must be an analog pin, use "An" notation! uint8_t XM = A2; // must be an analog pin, use "An" notation! uint8_t YM = 7; // can be a digital pin uint8_t XP = 6; // can be a digital pin uint8_t SwapXY = 0; uint16_t TS_LEFT = 920; uint16_t TS_RT = 150; uint16_t TS_TOP = 960; uint16_t TS_BOT = 120; char *name
in „Arduino Display Probleme“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
UserButton.ino
// show user button with by cycling leds // STM32F4 Discovery #define USERBUTTON PA0 #define GREENLED PD12 #define ORANGELED PD13 #define GREDLED PD14 #define BLUELED PD15 #define REDLEDOTGOVERCURRENT PD5 #define NUMLEDS 4 const uint8_t Led[] = {GREENLED, ORANGELED, GREDLED, BLUELED, REDLEDOTGOVERCURRENT}; void setup() { for (int n = 0; n < NUMLEDS; n++) pinMode(Led[n], OUTPUT); } void setLed(uint8_t n, uint8_t state) { digitalWrite(Led[n], state); } int n=0; void loop() { if( digitalRead(USERBUTTON) ) n++; if(n>=NUMLEDS)n=0; setLed(n, HIGH); delay(100); setLed(n, LOW); delay(100); }
in „STM32F4 Discovery Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
iirBenchmark.ino
// print with manual made software serial the // STM32F4 Discovery #include "softwareSerial.h" //#define SOFTSERIALPIN_TX PC1 // STM32F4_DISCOVRERY //#define SOFTSERIALPIN_TX PA9// STM32F103 BluePill #define SOFTSERIALPIN_TX PD1 // ARDUINO_UNO // https://gist.github.com/nikolaypavlov/f4832cba720917b16905 // // Fourth order bandpass IIR filter coefficients (100 Hz - 500 Hz, sampling rate 22050 Hz) // // a[0]*y[n] + a[1]*y[n-1] + … + a[n]*y[0] = b[0]*x[n] + b[1]*x[m-1] + … + b[m]*x[0] // #include <stdio.h> const float a[5] = {1, -3.91745514489661, 5.75755576410991, -3.76266550602334, 0.922565876650813
in „STM32 Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_wf_pwm.ino
void setup() { pinMode(5, OUTPUT); digitalWrite(5, LOW); pinMode(6, OUTPUT); digitalWrite(6, LOW); pinMode(9, OUTPUT); digitalWrite(9, LOW); pinMode(10, OUTPUT); digitalWrite(10, LOW); bitSet (TCCR0B, CS20); bitClear (TCCR0B, CS21); bitClear (TCCR0B, CS22); bitClear (TCCR0A, COM0A0); bitSet (TCCR0A, COM0A1); bitSet (TCCR0A, COM0B0); bitSet (TCCR0A, COM0B1); bitSet (TCCR0A, WGM20); bitClear (TCCR0A, WGM21); bitClear (TCCR0B, WGM22); bitSet (TCCR1B, CS20); bitClear (TCCR1B, CS21); bitClear (TCCR1B, CS22); bitClear (TCCR1A, COM1A0); bitSet (TCCR1A, COM1A1); bitSet (TCCR1A, COM1B0); bitSet (TCCR1A
in „µC - BUCK - BOOST Konverter“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
serialAccelerometer.ino
// read accelaration sensor and print serial // TX pin is PD8 // STM32F4 Discovery // accelerometer: LIS203DL ( included in STM32F4, some boards may have the LIS3DSH ) // example from http://stm32duino.com/viewtopic.php?t=282 /* // serial interfaces // the serial interface numbers seem to be somehow mixed up #define BOARD_NR_USARTS 5 #define BOARD_USART1_TX_PIN Port2Pin('A', 9) #define BOARD_USART1_RX_PIN Port2Pin('A',10) #define BOARD_USART2_TX_PIN Port2Pin('A', 2) #define BOARD_USART2_RX_PIN Port2Pin('A', 3) #define BOARD_USART3_TX_PIN Port2Pin('D', 8) // Serial2 ?? #define BOARD_USART3_RX_PIN
in „STM32F4 Discovery Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
benchmark_peripheral.ino
//define LED_BUILTIN 13 // for Arduino Uno void setup() { Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); delay(3000); Serial.println("***************************************************"); Serial.println("* Arduino Benchmark *"); Serial.println("***************************************************"); Serial.println(""); } void benchmark_digitalWrite(uint32_t count) { uint32_t n; for(n=0;n<count/8;n++) { // unroled loop to minimize for loop influence digitalWrite(LED_BUILTIN,HIGH); digitalWrite(LED_BUILTIN,LOW); digitalWrite(LED_BUILTIN,HIGH); digitalWrite(LED_BUILTIN,LOW); digitalWrite(LED_BUILTIN
in „Arduino Benchmark auf verschiedenen MCUs“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sonnenschutz_001.ino
int a = 2; int B = 0; int n; int x; int y; int z; int W = 10; int X = 11; int Y = 12; int Z = 13; int h = 4; int i = 5; int j = 6; int k = 7; void setup() { pinMode(a,INPUT_PULLUP); // HIGH bei Sonne pinMode(h,INPUT_PULLUP); // Unterbrecher unten rechts pinMode(i,INPUT_PULLUP); // Unterbrecher oben rechts pinMode(j,INPUT_PULLUP); // Unterbrecher unten links pinMode(k,INPUT_PULLUP); // Unterbrecher oben links pinMode(W,OUTPUT); pinMode(X,OUTPUT); // wx Motor rechts pinMode(Y,OUTPUT); pinMode(Z,OUTPUT); // yz Motor links pinMode(B,OUTPUT); // interne Rechengröße } void loop() { if (digitalRead(a
in „Arduino: Invertieren und Zwischenspeichern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sonnenschutz_002.ino
int a = 2; int b; int c; // int x; // int y; // int z; int W = 10; int X = 11; int Y = 12; int Z = 13; int h = 4; int i = 5; int j = 6; int k = 7; void setup() { pinMode(a,INPUT_PULLUP); // HIGH bei Sonne pinMode(h,INPUT_PULLUP); // Unterbrecher unten rechts pinMode(i,INPUT_PULLUP); // Unterbrecher oben rechts pinMode(j,INPUT_PULLUP); // Unterbrecher unten links pinMode(k,INPUT_PULLUP); // Unterbrecher oben links pinMode(W,OUTPUT); pinMode(X,OUTPUT); // wx Motor rechts pinMode(Y,OUTPUT); pinMode(Z,OUTPUT); // yz Motor links } void loop() { b = ! digitalRead(a) ; c = b && digitalRead(h); if (c
in „Arduino: Invertieren und Zwischenspeichern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
CNCArduinoControl.ino
#include <Wire.h> //Ein/Aus-gänge int PinDirX = 2;//2Pin4 int PinDirY = 3;//3Pin5 int PinDirZ = 4;//4Pin6 int PinStepX = 5;//5Pin11 int PinStepY = 6;//6Pin12 int PinStepZ = 7;//7Pin13 int PinEndschalterX = 8;//Pin14 int PinEndschalterY = 9;//Pin15 int PinEndschalterZ = 10;//Pin16 int PinEmpfangsStatus = 11;//Pin17 int PinSyncStart = 12;//Pin18 int PinStatusLED = 13; // Parameter für Achsen long XCoordinate = 0; long YCoordinate = 0; long ZCoordinate = 0; int Impulslange = 30; float WegProSchritt = 0.0025; float Beschleunigung = 250; float Geschwindigkeit = 250; boolean Motorfahren = false; boolean
in „Delay funktioniert nur in loop (Arduino)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ServoSlave.ino
#include <Automate.h> #include <Filter.h> #include <GestionDonneeFlash.h> #include <ifdef.h> #include <MAGesture.h> #include <MCalculcoordonnees.h> #include <MFilter.h> #include <MGesture.h> #include <MGestureGlobale.h> #include <MGestureRotate.h> #include <MGestureTranslate.h> #include <MLinearisation.h> #include <MMagneticGrid.h> #include <MTransMMtoAff.h> #include <MVariable.h> #include <Parameters.h> #include <Primitive8par8.h> #include <Regulation.h> #include <Scrutation.h> #include <SendValueByUART.h> #include <ToucheClavier.h> #include <Wire.h> #include <Adafruit_PWMServoDriver.h> #define SERVOMIN
in „Roboterarm mit Gestensteuerung HILFE I2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
AVR_JTAG.ino
// Using an Arduino as simple JTAG programmer (v1.0) // Example is used to read fuses for an ATMEGA644 // It can be easily modified for other MCUs or to set fuses rather than just reading them // Example written by Felix Vietmeyer (Felix.Vietmeyer@gmail.com) // It is inspired by jtag bang - serial JTAG interface for the Arduino by pesco, 2013 #define ACTIVE HIGH // Logic level for 'true' on JTAG lines #define CLKDELAY 1 // ms delay between clock edges #define TMS 8 #define TDI 9 #define TDO 10 #define TCK 11 #define LED 13 const char *menu = "+++++=====+++++ MENU +++++=====+++++\r\n" "Y reads the
-
Datei
FINAL_OLED.ino
#include <TinyWireM.h> // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos #include <avr/power.h> // needed to up clock to 16 MHz on 5v Trinket #include <dht.h> dht DHT; const byte DHT22_Pin = 1; //const int analogInPin = 3; //int sensorValue = 0; #include "SSD1306_minimal.h" //#include <avr/pgmspace.h> //#define DEG "\xa7" "C" SSD1306_Mini oled; // Struct for sending measured data /* struct Data { uint16_t temp; // Temperature value uint16_t hum; // Humidity value int status; // DHT22 module status } data; */ void setup(){ if (F_CPU == 16000000) clock_prescale_set
in „Attiny85 dht22 oled ssd1306 i2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Resive-1.ino
// // Test der Seriellen Komunikation zweier Arduinos // // ein Arduino steuert die Luzy // der andere Übernimmt die Anzeige // String inputString = ""; boolean stringComplete = false; void setup() { Serial.begin(9600); Serial1.begin(9600,SERIAL_7N1); inputString.reserve(200); } void loop() { if (stringComplete) { Serial.println(inputString); inputString = ""; stringComplete = false;} } void serialEvent1() { while (Serial1.available()) { // zeichen da? schleife bis keine mehr da char inChar = (char)Serial1.read(); // zeichen lesen inputString += inChar; // zeichen zum test hinzu if (inChar == '\n') { // letztes
in „zwei Arduino Serielle Verbindung spinnt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sender-1.ino
// // Test der Seriellen Komunikation zweier Arduinos // // ein Arduino steuert die Luzy // der andere Übernimmt die Anzeige // String inputString = ""; boolean stringComplete = false; int i = 0; void setup() { Serial.begin(9600); Serial1.begin(9600, SERIAL_7N1); inputString.reserve(200); } void loop() { i = ++i; Serial1.print("-"); Serial1.print(i); Serial1.println("-"); if (stringComplete) { Serial1.print(inputString); inputString = ""; stringComplete = false;} delay(200); } void serialEvent() { while (Serial.available()) { // zeichen da? schleife bis keine mehr da char inChar = (char)Serial.read
in „zwei Arduino Serielle Verbindung spinnt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
arduino328.ino
/* AVR standard libs */ #include <avr/wdt.h> #include <avr/power.h> #include <avr/sleep.h> #include <avr/io.h> /* C standard Libs */ #include <stdint.h> /* Projekt Libs */ #include <SPI.h> #include <nRF24L01.h> #include <DHT.h> #include <printf.h> #include <RF24.h> #include <RF24_config.h> #include <DallasTemperature.h> #include <OneWire.h> #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 #define DHTPIN 2 // what digital pin we're connected to #define CE_PIN 8 // CE NRF24L01 #define CSN_PIN 7 // CSN NRF24L01 #define RF_CHANNEL 75 /* ACK Datensatz */ struct { uint8_t feuchte_enable, // 1 = Sende
in „Zeigt her eure Kunstwerke (2017-2019)“ · Projekte & Code ·
-
Datei
arduino328.ino
/* AVR standard libs */ #include <avr/wdt.h> #include <avr/power.h> #include <avr/sleep.h> #include <avr/io.h> /* C standard Libs */ #include <stdint.h> /* Projekt Libs */ #include <SPI.h> #include <nRF24L01.h> #include <DHT.h> #include <printf.h> #include <RF24.h> #include <RF24_config.h> #include <DallasTemperature.h> #include <OneWire.h> #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 #define DHTPIN 2 // what digital pin we're connected to #define CE_PIN 8 // CE NRF24L01 #define CSN_PIN 7 // CSN NRF24L01 #define RF_CHANNEL 75 // Der Transfer Datensatz struct data_t { uint16_t id; uint16_t
in „NRF24L01+ auf STM32F103: Ich weiss nicht mehr weiter :-(“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
drehencoder_ohne_interrupt.ino
#define PHASE_A (PINA & 1<<PA1) #define PHASE_B (PINA & 1<<PA3) int main( void ) { int8_t enc_delta = 0; // -128 ... 127 int8_t last; int8_t val = 0; int8_t neu, diff; DDRB |= (1 << PB0) ^ (1 << PB1); // PB0 und PB1 als Ausgänge DDRA |= (1 << PA2); // PA2 als Ausgang PORTA &= ~(1 << PA2); // PA2 als LOW, GND PORTA |= (1 << PA1) | (1 << PA3); // PA1, PA3 als Eingänge mit Pullup neu = 0; if( PHASE_A ) neu = 3; if( PHASE_B ) neu ^= 1; // convert gray to binary last = neu; // power on state for(;;){ neu = 0; if( PHASE_A ) neu = 3; if( PHASE_B ) neu ^= 1; // convert gray to binary diff = last - neu
in „Drehencoder zu schnell auslesen?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ReadNUID.ino
/* * -------------------------------------------------------------------------------------------------------------------- * Example sketch/program showing how to read new NUID from a PICC to serial. * -------------------------------------------------------------------------------------------------------------------- * This is a MFRC522 library example; for further details and other examples see: https://github.com/miguelbalboa/rfid * * Example sketch/program showing how to the read data from a PICC (that is: a RFID Tag or Card) using a MFRC522 based RFID * Reader on the Arduino SPI interface.
in „Arduino UNO und MFRC522 NFC Reader/Writer“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Area51.ino
#define ADDRESSING_A //#define ADDRESSING_B #ifdef ADDRESSING_A #define PIN_MOTD_IN 0 #define PIN_LED_OUT 1 #else #define PIN_MOTD_IN 1 #define PIN_LED_OUT 2 #endif int val = 0; void setup() { pinMode(PIN_LED_OUT, OUTPUT); digitalWrite(PIN_LED_OUT, LOW); } void loop() { val = digitalRead(PIN_MOTD_IN); digitalWrite(PIN_LED_OUT, val); delay(50); }
in „ATtiny84, FTDI FT232RL, SofwareSerial.h, Arduino ISP“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Drucker_Emu.ino
/* D0...D3 auf PB0..PB3 (D8...D11) PORT_LOW D4...D7 auf PD4...PD7 (D4...D7) PORT_HIGH Strobe PD2 (D2) Ack PD3 (D3) Busy PB4 (D12) */ #define STROBE 2 // Arduino-Pin #define ACK 3 // Arduino-Pin #define BUSY 12 // Arduino-Pin void setup() { PORTB = PORTB | 0b00010000; // Busy auf H, erstmal Gerät nicht bereit setzen PORTD = PORTD | 0b00001000; // Busy auf H, erstmal Gerät nicht bereit setzen DDRB = (DDRB & 0b11100000) | 0b00010000; // PB0...PB3 Eingang Daten 0...3, PB4 Ausgang Busy DDRD = (DDRD & 0b00000011) | 0b00001000; // PD4...PD7 Eingang Daten 4...7, PD2 Eingang Strobe, PD3 Ausgang Ack Serial.begin
in „Druckausgabe eines Wetter-Fax-Decoders auf Raspi umleiten“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
shutter_test.ino
//zwei potentiometer steuern einen servo #include <Servo.h> Servo myservo; int potpin = 1; int shutpin = 4; int hysterese = 5; int pos_saved, pos_akt, shut_akt, shut_saved, winkel, check_hys_shut, check_hys_pos, i; int delaytime = 5; int anzahl = 10; int pos_average[5], shut_average[5]; void setup(){ Serial.begin(9600); pinMode(potpin, INPUT); pinMode(shutpin, INPUT); myservo.attach(9); } void loop() { winkel = 0; for (i = 1; i < anzahl + 1; i++) { // Position Potentiometer1 (pos_akt) wird "entprellt" ermittelt pos_average[i] = analogRead(potpin); delay(delaytime); pos_akt = pos_akt + pos_average
in „analogRead läßt servo verstummen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ProtocolReceiver.ino
#include <RCSwitch.h> #define goingOnSignal 111 #define goingOffSignal 222 #define statStart 0 #define statId 1 #define statRec 2 #define statCheck 3 #define statEnding 4 #define statIdOne 1 #define statIdTwo 2 #define statIdThree 3 #define statIdFour 4 //Fails boolean error; //RCSwitch Area RCSwitch mySwitch = RCSwitch(); byte stat; byte statOfId = 1; byte goSignal; byte idOne; byte idTwo; byte idThree; byte idFour; byte ID; boolean check; byte ending; //transmission area long transmission; byte test; void setup() { Serial.begin(9600); mySwitch.enableTransmit(10); mySwitch.enableReceive(0); Serial.println
in „Probleme mit Switch/Case Abfrage“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
tsop48.ino
#define PIN_HIGH PORTD |= (1<<PD5); #define PIN_LOW PORTD &= ~(1<<PD5); #define PULSE_H 6 // us #define PULSE_L 20.3 // us void setup() { // put your setup code here, to run once: DDRD |= (1<<PD5); // set to output, avr gcc style } void loop() { int i, j; for (j=0; j<500; j++) { // 500 burst cycles for (i=0; i<23; i++) { // 23 pulses per burst PIN_HIGH _delay_us(PULSE_H); PIN_LOW _delay_us(PULSE_L); } _delay_us(23*(PULSE_H+PULSE_L)); // micro OFF time } _delay_ms(500); // burst OFF time }
in „Infrarot LED Lichtschranke“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Test_Neu.ino
//Initialisierung #include <EEPROM.h> //HEX-Datei zur EEPROM Initialisierung //Variablen int address = 0; byte value; byte x = 0; int SensorValueX = 0; int SensorValueY = 0; int SensorValueZ = 0; int SensorXmax = 0; int SensorYmax = 0; int SensorZmax = 0; //Begin des Setups. Diese Schleife wird nur einmal //nach einem Reset durchgeführt. ///////////////////////////////////////////////////////////////////////////////////////////////////////////// void setup() { //Setup begin - wird nur einmal am Anfang durchlaufen Serial.begin(9600); //Serielle Verbindung aufbauen mit Boudrate von 9600 while (millis
in „Auswertung eines MEMS-Sensors mit Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
HelloWorld.ino
/* HelloWorld.ino Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/) Copyright (c) 2016, olikraus@gmail.com All rights reserved. Redistribution and use in source and binary forms, with or without modification
in „ST7567 Display falsch mit Arduino Nano verbunden?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
SPI_Interrupt.ino
//Add the SPI library so we can communicate with the ADXL345 sensor #include <ESP8266WiFi.h> #include <WiFiUdp.h> #include "Arduino.h" #include <SPI.h> //Assign the Chip Select signal to pin 5. int CS=5; int interruptPin=4; volatile int loopi = 0; struct dirs{ int x; int y; int z; }; struct dirs accels[44]; // UDP-Buffer in Labview is 548 Bytes/ 12 Bytes = 44 (per sent packet): // x | y | z --> 0 0 0 0 | 0 0 0 0 | 0 0 0 0 int ArrayLength = ((sizeof(accels)/sizeof(int))/3)-1; WiFiUDP Udp; unsigned int localUdpPort = 4210; // local port to listen on IPAddress ip(192, 168, 1, 226); // destination device
in „ADXL345 und ESP8266: Echtzeitdatenergassung mit konstanter Abtastrate und Interrupts“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
EVE_one.ino
#include <SPI.h> #include <eve.h> int irq = 3; int pd = 2; void setup() { // put your setup code here, to run once: pinMode(pd,OUTPUT); digitalWrite(pd,HIGH); SPI.setBitOrder(MSBFIRST); SPI.setSS(HIGH); SPI.begin(); Serial1.begin(9600); eve_init(); delay(100); Anzeige_1(); delay(10000); Anzeige_2(); } void loop() { } void eve_init() { digitalWrite(pd,LOW); delay(20); digitalWrite(pd,HIGH); delay(20); host_command(FT_CLKEXT); host_command(FT_ACTIVE); delay(500); // init Display wr8(REG_PCLK, 0); wr8(REG_PWM_DUTY,16); wr16(REG_VSIZE, 0xE001); wr16(REG_VCYCLE, 0x1002); wr16(REG_VOFFSET, 0x0400);
-
Datei
EVE_one.ino
#include <SPI.h> #include <eve1.h> static size_t dli; int irq = 3; int pd = 2; void setup() { // put your setup code here, to run once: pinMode(pd,OUTPUT); digitalWrite(pd,HIGH); SPI.setBitOrder(MSBFIRST); SPI.setSS(HIGH); SPI.begin(); Serial1.begin(9600); eve_init(); delay(1000); Anzeige_1(); delay(10000); Anzeige_2(); delay(10000); Anzeige_3(); } void loop() { } void eve_init() { digitalWrite(pd,LOW); delay(20); digitalWrite(pd,HIGH); delay(20); host_command(CLKEXT); host_command(ACTIVE); delay(500); // init Display wr8(REG_PCLK, 0); wr8(REG_PWM_DUTY,16); wr16(REG_VSIZE, 0x01E0); wr16(REG_VCYCLE
-
Datei
EVE_one.ino
#include <SPI.h> #include <eve1.h> static size_t dli; int irq = 3; int pd = 2; void setup() { // put your setup code here, to run once: pinMode(pd,OUTPUT); digitalWrite(pd,HIGH); SPI.setBitOrder(MSBFIRST); SPI.setSS(HIGH); SPI.begin(); Serial1.begin(9600); eve_init(); delay(1000); Anzeige_1(); delay(10000); Anzeige_2(); delay(10000); Anzeige_3(); } void loop() { } void eve_init() { digitalWrite(pd,LOW); delay(20); digitalWrite(pd,HIGH); delay(20); host_command(CLKEXT); host_command(ACTIVE); delay(500); // init Display wr8(REG_PCLK, 0); wr8(REG_PWM_DUTY,16); wr16(REG_VSIZE, 0x01E0); wr16(REG_VCYCLE
-
Datei
blinky_bluepill.ino
/* STM32 BluePill blinky Funktioniert mit einem unveränderten BluePill und ST-Link Programmierung. Auf den Pins PA0 bis PA12, PA15 und PB0 bis PB1, PB3 bis PB15 und PC13 bis PC15. Nur PB13 hat noch Einschränkungen. Vorraussetzung ist Arduino 1.8.5 in Voreinstellung eingetragen: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json und mit dem Boardverwalter (Boardmanager) dann dazugeladen: STM32 Cores by ST-Microelektronics Version 1.3.0 */ #define LED_PCB PC13 // Setup Einstellungen nach einem Reset void setup() { // Stelle den digital pin LED_PCB als Ausgang ein pinMode
in „stm32f103-bluepill-peripherie“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Fonktion001.ino
#include "Fonktion.h" Tval tval; void setup() { Serial.begin(9600); Serial.print(tval); } void loop() { }
in „conflicting types for 'fonction'“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
FlipDot.ino
/******************************************************** ** Projekt Flipdot ** ********************************************************/ #include <Wire.h> #include "Adafruit_MCP23017.h" Adafruit_MCP23017 mcp; // die Zeichenkodierung uint8_t hex2dot[][5] = { {0x7, 0x5, 0x5, 0x5, 0x7}, // 0 {0x2, 0x2, 0x2, 0x2, 0x2}, // 1 {0x7, 0x1, 0x7, 0x4, 0x7}, // 2 {0x7, 0x1, 0x3, 0x1, 0x7}, // 3 {0x5, 0x5, 0x7, 0x1, 0x1}, // 4 {0x7, 0x5, 0x7, 0x1, 0x7}, // 5 {0x4, 0x4, 0x7, 0x5, 0x7}, // 6 {0x7, 0x5, 0x1, 0x1, 0x1}, // 7 {0x7, 0x5, 0x7, 0x5, 0x7}, // 8 {0x7, 0x5, 0x7, 0x1, 0x1}, // 9 {0x0, 0x7, 0x0, 0x7,
in „Flipdot Display Projekt (Hilfe Logik Erbeten)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
FlipDot.ino
/******************************************************** ** Projekt Flipdot ** ********************************************************/ #include <Wire.h> #include "Adafruit_MCP23017.h" Adafruit_MCP23017 mcp; // die Zeichenkodierung uint8_t hex2dot[][5] = { {0x7, 0x5, 0x5, 0x5, 0x7}, // 0 {0x2, 0x2, 0x2, 0x2, 0x2}, // 1 {0x7, 0x1, 0x7, 0x4, 0x7}, // 2 {0x7, 0x1, 0x3, 0x1, 0x7}, // 3 {0x5, 0x5, 0x7, 0x1, 0x1}, // 4 {0x7, 0x5, 0x7, 0x1, 0x7}, // 5 {0x4, 0x4, 0x7, 0x5, 0x7}, // 6 {0x7, 0x5, 0x1, 0x1, 0x1}, // 7 {0x7, 0x5, 0x7, 0x5, 0x7}, // 8 {0x7, 0x5, 0x7, 0x1, 0x1}, // 9 {0x0, 0x7, 0x0, 0x7,
in „Flipdot Display Projekt (Hilfe Logik Erbeten)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test1.ino
#include <DallasTemperature.h> OneWire ds(48); //pin für ds18b20 #include <Wire.h> //Speicher Temp float temp1 = 1; float temp2 = 1; float temp3 = 1; float temp4 = 1; float temp5 = 1; void setup(void) { pinMode(13, OUTPUT); Serial.begin(9600); } // HIER must du >deine< andressen eintragen // einzeln ermittel. DeviceAddress sensor1 = { 0x28, 0xFF, 0x86, 0x2E, 0x74, 0x16, 0x3, 0xAF };//Temp DeviceAddress sensor2 = { 0x28, 0xFF, 0x5, 0x72, 0x74, 0x16, 0x3, 0xE0 }; DeviceAddress sensor3 = { 0x28, 0xFF, 0x2B, 0x3F, 0x73, 0x16, 0x5, 0x60 }; DeviceAddress sensor4 = { 0x28, 0xFF, 0xC5, 0x11, 0x73, 0x16
in „DS18B20 Verkabelungs od Software Problem“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ESP_NTP.ino
#include <ESP8266WiFi.h> #include <time.h> #define WIFI_SSID "xxxxxxxxxx" #define WIFI_PASSWORD "xxxxxxxxxx" int timezone = 2; // MESZ //###################################################################### void setup() { Serial.begin(115200); Serial.println("\r\nReset"); // Start WiFi WiFi.mode(WIFI_STA); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.print("Wifi connect."); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("OK"); Serial.print("IP: "); Serial.println(WiFi.localIP()); // Start Time service. configTime(timezone * 3600, 0, "pool.ntp.org", "time.nist.gov
in „Nixie Uhr Probleme :-(“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
EncoderSimulation.ino
/* Encoder Simulation Simple Test by Toxic */ #define Enc_A 3 #define Enc_B 5 unsigned char state = 0; unsigned char EncState_A[4] = {1,1,0,0}; unsigned char EncState_B[4] = {1,0,0,1}; // the setup function runs once when you press reset or power the board void setup() { // initialize digital pins as outputs. pinMode(Enc_A, OUTPUT); pinMode(Enc_B, OUTPUT); Serial.begin(57600); } void loop() { for (state = 0; state < 4; state++) { digitalWrite(Enc_A, EncState_A[state]); delay(1); digitalWrite(Enc_B, EncState_B[state]); delay(1); Serial.print(EncState_A[state]); Serial.print(EncState_B[state]); delay
in „Thermostat / Encoder Steuerung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
HRL-Arduino.ino
// Get next command from Serial (add 1 for final 0) #define INPUT_SIZE 30 #define output_links 43 #define output_rechts 28 #define output_vor 51 #define output_rueck 53 #define output_hoch 49 #define output_runter 47 #define input_links 2 #define input_rechts 3 #define input_vor 18 #define input_rueck 19 #define input_hoch 20 #define input_runter 21 void counterLinks(); void stoppRechts(); void stoppVor(); void stoppRueck(); void stoppHoch(); void counterRunter(); //const int AOUTpin= 13; int endData[3]; int index = 0; volatile int counter_links = 0; volatile int counter_runter = 0; String stat
in „[Fischertechnik] Taster schicken Störsignale und gehen in Interruptfunktion(Arduino)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
EEPROM_Incr.ino
#include <EEPROM.h> void setup() { Serial.begin(9600); Serial.println("Start"); Serial.println("gib index (1 bis 5) ein, gefolgt von enter, um gespeicheren Wert um 1 zu erhöhen"); Serial.println("Gib p ein um den Inhalt des EEproms zu lesen "); } void loop() { } void serialEvent() { switch(Serial.read()) { case '1': EEPROM[1]++; break; case '2': EEPROM[2] += 1; break; case '3': EEPROM[3]++; break; case '4': EEPROM[4]++; break; case '5': EEPROM[5]++; break; case 'p': Serial.println("Start Print"); for(int i = 1; i <= 5;i++) { Serial.print("Index: "); Serial.print(i); Serial.print(" Value: "); Serial.println
in „Daten auf EEPROM schreiben und Zeit dazu addieren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
EEPROM_Incr.ino
#include <EEPROM.h> #include <Streaming.h> void setup() { Serial.begin(9600); Serial << "Start" << endl; Serial << "gib index (1 bis 5) ein, gefolgt von enter, um gespeicheren Wert um 1 zu erhoehen" << endl; Serial << "Gib p ein um den Inhalt des EEproms zu lesen " << endl; } void loop() { } void serialEvent() { switch(Serial.read()) { case '1': EEPROM[1]++; break; case '2': EEPROM[2] += 1; break; case '3': EEPROM[3]++; break; case '4': EEPROM[4]++; break; case '5': EEPROM[5]++; break; case 'p': Serial << "Start Print" << endl; for(int i = 1; i <= 5;i++) { Serial << "Index: " << i << " Value: " << EEPROM
in „Daten auf EEPROM schreiben und Zeit dazu addieren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Kerzen-Test.ino
/* Brute Force IR-Weihnachtskerzentest Please install this library first: https://github.com/z3t0/Arduino-IRremote */ #include <IRremote.h> uint32_t bits = 0; uint8_t command = 0; uint8_t notCommand = 0; uint8_t address = 0; uint8_t notAddress = 0; uint16_t address16 = 0; IRsend irsend; void setup() { Serial.begin(500000); Serial.println("Reset"); } void loop() { /* // try all 8 bit addresses for (address = 0; address < 255; address++) { notAddress = ~address; notCommand = ~command; bits = address; bits = bits << 8; bits |= notAddress; bits = bits << 8; bits |= command; bits = bits << 8; bits
in „Weihnachtskerzen IR-Protokoll“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
led_blink.ino
#define LED_PIN_1 7 #define LED_PIN_2 8 #define LED_PIN_3 4 #define BUTTON_PIN 2 /******************************************************************************/ struct ledseq { /* kleinste Zeitbasis für die Verarbeitung in ms */ uint32_t time_base; /* Die verwendete Blink-Sequenz */ char *seq; /* Länge der Blink-Sequenz */ size_t len; /* LED Ausgang (PIN) */ uint8_t pin; /* Startzeitpunkt (Aktiv-Flag für Verarbeitung) */ bool start_ms; /* Verarbeitungsschritt */ uint32_t step; }; char seq_1[] = "-----o-o--------\0"; char seq_2[] = "-------------o-o\0"; char seq_3[] = "o-\0"; /********************
in „millis() mit if aufrufen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
oszillation2.ino
double osc = 10, osc0; void setup() { Serial.begin (9600); } void loop() { osc0 = osc0 - 0.01 * ( osc0 - osc); osc = (osc - osc0) * 1.0101; // For serialPlotter Serial.print (osc0); Serial.print ("\t"); Serial.println (osc); }
in „Numerischer Sinusoszillator, Zufallsentdeckung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
SoftSPI.ino
#include <SPI.h> #define SS 9 #define LED 4 int i = 0; void setup() { Serial.begin(9600); // put your setup code here, to run once: pinMode(SS, OUTPUT); pinMode(10, OUTPUT); pinMode(LED, OUTPUT); pinMode(3, OUTPUT); digitalWrite(SS, HIGH); digitalWrite(3, LOW); } void loop() { // put your main code here, to run repeatedly: digitalWrite(SS, LOW); //delay(500); SPI.beginTransaction(SPISettings(100, MSBFIRST, SPI_MODE2)); i = SPI.transfer(0); SPI.endTransaction(); digitalWrite(SS, HIGH); Serial.print(i); delay(500); }
in „Attiny13 SoftSPI Slave“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
SiedleESP.ino
#include <ESP8266WiFi.h> #include <PubSubClient.h> /*--------------------------------------------*/ /* DEFAULT VALUES */ /*--------------------------------------------*/ #define WIFI_RECONNECT 5000 // Delay between wifi reconnection tries #define MQTT_RECONNECT 5000 // Delay between mqtt reconnection tries // GPIO settings #define INPUT_PIN 1 // GPIO1 -> Rx pin as input for doorbell recognition #define OUTPUT_PIN 2 // GPIO2 -> Output for door opener // Basic app settings #define ENABLE_DOOROPEN false // If enabled, door can be opened with payload DOOROPEN_KEYWORD in MQTT_TOPIC #define DOOROPEN_KEYWORD
-
Datei
LEDWeiterschaltenCallback.ino
/** * * LED Schaltfolge * * Ein Taster, zwei LEDs * * Startzustand beide aus. * Erster Tastendruck, led1 geht an * Zweiter Tastendruck, led2 geht an * Dritter Tastendruck, beide LEDs gehen aus, Automat geht in den Startzustand * * * */ #include <CombiePin.h> #include <CombieTimer.h> #include <CombieTools.h> using namespace Combie::Tools; using namespace Combie::Timer; using namespace Combie::Pin; using CounterType = Counter<byte>; TasterGND<2> taster; // Taster gegen GND geschaltet OutputPin<13> led1; OutputPin<12> led2; EntprellTimer entprellen(20); FlankenErkennung flankenerkennung; CounterType counter
in „PORT/Register Beschreibung in AVR“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
batteryinputsleepnrf52.ino
#include <SPI.h> #include <BLEPeripheral.h> #include "Ucglib.h" #include <nrf_nvic.h>//interrupt controller stuff #include <nrf_sdm.h> #include <nrf_soc.h> #include <WInterrupts.h> #include <Wire.h> // sd_nvic_SystemReset(); #define ana 31 Ucglib_ST7735_18x128x160_HWSPI ucg(/*cd=*/ 13, /*cs=*/ 11, /*reset=*/ 12); #define BUTTON_PIN 27 #define INTERRUPT_PIN 26 #define BATTERY_PIN 28 BLEPeripheral blePeripheral = BLEPeripheral(); BLEService batteryLevelService = BLEService("180F"); BLEUnsignedCharCharacteristic batteryLevelChar = BLEUnsignedCharCharacteristic("2A19", BLERead | BLENotify); BLEDescriptor
in „Arduino Custom Firmware für Fitness Armband mit NRF52“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
schnell_schalten.ino
#include <PortBitList.h> const byte pin = 13; void setup() { pinMode(pin, OUTPUT); } void loop() { digitalSwitch(pin, HIGH); // 4MHz digitalSwitch(pin, LOW); digitalSwitch(pin, HIGH); digitalSwitch(pin, LOW); digitalSwitch(pin, HIGH); digitalSwitch(pin, LOW); digitalSwitch(pin, HIGH); digitalSwitch(pin, LOW); digitalSwitch(pin, HIGH); digitalSwitch(pin, LOW); }
in „C++ Klassenbibliothek für AVR“ · Mikrocontroller und Digitale Elektronik ·