-
Datei
test_max3100.ino
#define MAX_CS 4 #define MAX_MOSI 2 #define MAX_MISO 3 #define MAX_SCK 5 // SOFT-SPI uint16_t MAX_IO(uint16_t data) { uint16_t i, rx=0; digitalWrite(MAX_CS, LOW); for (i=0; i<16; i++) { rx <<= 1; if (digitalRead(MAX_MISO)) { rx |= 1; } if (data & 0x8000) { digitalWrite(MAX_MOSI, HIGH); } else { digitalWrite(MAX_MOSI, LOW); } data <<= 1; digitalWrite(MAX_SCK, HIGH); digitalWrite(MAX_SCK, LOW); } digitalWrite(MAX_CS, HIGH); return rx; } uint8_t MAX_TX_available(void) { if (MAX_IO(0x8400) & (1<<14)) { return 1; } else { return 0; } } uint8_t MAX_RX_available(void) { if (MAX_IO(0x8400) & (1<<15)) { return
in „FIFO im MAX3100“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test_max3100.ino
#define MAX_CS 4 #define MAX_MOSI 2 #define MAX_MISO 3 #define MAX_SCK 5 // config, XTAL=3,6864MHz #define CFG 0xC000 // 230k4 //#define CFG 0xC001 // 115k2 //#define CFG 0xC002 // 57k6 //#define CFG 0xC003 // 28k8 //#define CFG 0xC004 // 14k4 //#define CFG 0xC005 // 7k2 //#define CFG 0xC006 // 3k6 //#define CFG 0xC007 // 1k8 //#define CFG 0xC008 // 76k8 //#define CFG 0xC009 // 38k4 //#define CFG 0xC00A // 19k2 //#define CFG 0xC00B // 9k6 //#define CFG 0xC00C // 4k8 //#define CFG 0xC00D // 2k4 //#define CFG 0xC00E // 1k2 //#define CFG 0xC00F // 600 // SOFT-SPI, Arduino style /* uint16_t MAX_IO
in „FIFO im MAX3100“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DTZ_Logger_WLAN.ino
/** * DTZ 541 Logger **/ #include <ESP8266WiFi.h> //ESP8266 Core WiFi Library #include <ESP8266WiFiMulti.h> //ESP8266 Core WiFi Library #include <DNSServer.h> #include <ESP8266WebServer.h> //Local WebServer #include <NTPClient.h> #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager #include <ESP8266HTTPClient.h> #include <WiFiClient.h> ADC_MODE(ADC_VCC); #define BoardTaster 0 #define MESZ 0 // summer-time = 1 else winter-time = 0 #define MaxBuffer 552 // maximum buffe for received bytes unsigned int year = 0; byte month = 0; int day = 0; int years=0; byte hour = 0; byte minute =0; byte
in „DTZ541 mMe Datenlogger mit ESP (WEB-Sicht)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ReadAngleTest.ino
#include <Tle5012b.h> /*! * \name ReadAngleTest * \author Infineon Technologies AG * \copyright 2019 Infineon Technologies AG * \version 2.0.1 * \brief * This example reads all main Sensor registers (angle,revolution,speed,range and temperature) * for a simple first test of the sensor and comunication. * * \Attention * We use default very low spee 9600 baud, but the sensor can much more, see the other examples */ Tle5012b Tle5012MagneticAngleSensor; errorTypes checkError = NO_ERROR; void setup() { delay(2000); Serial.begin(9600); checkError = Tle5012MagneticAngleSensor.begin(); Serial.print("checkError
in „Infineon Evaluationboard TLE5012B auslesen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DTZ_Logger_WLAN.ino
/** * DTZ 541 Logger * Version 0.2 * 25.11.2020 P. Rebesky **/ #include <ESP8266WiFi.h> //ESP8266 Core WiFi Library #include <ESP8266WiFiMulti.h> //ESP8266 Core WiFi Library #include <DNSServer.h> #include <ESP8266WebServer.h> //Local WebServer #include <NTPClient.h> #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager #include <ESP8266HTTPClient.h> #include <WiFiClient.h> ADC_MODE(ADC_VCC); #define BoardTaster 0 #define MESZ 0 // summer-time = 1 else winter-time = 0 #define MaxBuffer 552 // maximum buffe for received bytes //const PROGMEM char *typeVersion = "DTZ log V0.2"; //const
in „DTZ541 mMe Datenlogger mit ESP (WEB-Sicht)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
GxEPD_Example.ino
// GxEPD_Example : test example for e-Paper displays from Waveshare and from Dalian Good Display Inc. // // Created by Jean-Marc Zingg based on demo code from Good Display, // available on http://www.e-paper-display.com/download_list/downloadcategoryid=34&isMode=false.html // // The e-paper displays are available from: // // https://www.aliexpress.com/store/product/Wholesale-1-54inch-E-Ink-display-module-with-embedded-controller-200x200-Communicate-via-SPI-interface-Supports/216233_32824535312.html // // http://www.buy-lcd.com/index.php?route=product/product&path=2897_8363&product_id=35120 //
in „ESP8266 mit Waveshare 7,5" E-Paper - funktioniert nicht“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DTZ_Logger_WLAN.ino
/** * DTZ 541 Logger * Version 0.9 * 10.12.2020 P. Rebesky **/ #include <ESP8266WiFi.h> //ESP8266 Core WiFi Library #include <ESP8266WiFiMulti.h> //ESP8266 Core WiFi Library #include <DNSServer.h> #include <ESP8266WebServer.h> //Local WebServer #include <NTPClient.h> #include <WiFiManager.h> // https://github.com/tzapu/WiFiManager #include <ESP8266HTTPClient.h> #include <WiFiClient.h> ADC_MODE(ADC_VCC); #define BoardTaster 0 #define MESZ 0 // summer-time = 1 else winter-time = 0 #define MaxBuffer 552 // maximum buffe for received bytes #define polynom 0x1021 // x16 + x12 + x5 + 1 0x1021 //const
in „DTZ541 mMe Datenlogger mit ESP (WEB-Sicht)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
FrequencyCounterUno.ino
#include <FreqCount.h>//https://github.com/PaulStoffregen/FreqCount/archive/master.zip #include <TM1638plus.h> // GPIO I/O pins on the Arduino connected to strobe, clock, data, //pick on any I/O you want. #define STROBE_TM 4 // strobe = GPIO connected to strobe line of module #define CLOCK_TM 2 // clock = GPIO connected to clock line of module #define DIO_TM 3 // data = GPIO connected to data line of module bool high_freq = false; //default false,, If using a high freq CPU > ~100 MHZ set to true. //Constructor object (GPIO STB , GPIO CLOCK , GPIO DIO, use high freq MCU) TM1638plus tm(STROBE_TM, CLOCK_TM
-
Datei
Arduino_Test_Code.ino
#include <SPI.h> // Pin definitions #define CS_PIN 7 //#define SCLK_PIN 9 //#define MISO_PIN 8 //#define MOSI_PIN 10 #define reset_PIN 5 // Reset Pin void setup() { Serial.begin(115200); while (!Serial); // Chip Select pin pinMode(CS_PIN, OUTPUT); digitalWrite(CS_PIN, HIGH); // Configure reset pin pinMode(reset_PIN, OUTPUT); digitalWrite(reset_PIN, HIGH); // reset ADC // Initialize SPI using Mode 1 (CPOL=0, CPHA=1) SPI.begin(); // Send Software reset before the first communication resetADC(); // Read and print multiple registers uint16_t deviceID = readRegister(0x03); // Device ID register Serial.print
in „Problem mit der SPI Datenübertragung zwischen einem Arduino Portenta H7 und einem ADS8684 (ADC)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
tastatur_dfplayer_display.ino
#include <Wire.h> #include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_ST7735.h> // Richtig konfigurierte SPI-Pins für ESP8266 #define TFT_CS 15 // D8 #define TFT_RST 16 // D0 #define TFT_DC 2 // D4 // ST7735 Display initialisieren Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); #include "Arduino.h" #include "DFRobotDFPlayerMini.h" #include <SoftwareSerial.h> SoftwareSerial softSerial(D1, D2); // RX, TX Pins #define FPSerial softSerial DFRobotDFPlayerMini myDFPlayer; void printDetail(uint8_t type, int value); // PCF8574 für Tastatur (I2C-Adresse: 0x20) #define PCF8574_ADDR
in „ESP8266 mit SPI Display und DF Player“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
AvrAddrSpace.ino
#include <avr/pgmspace.h> namespace AddrSpaces { template <size_t N> struct IntegralConstant {}; template<class T> struct is_const { static constexpr bool value = false; }; template<class T> struct is_const<const T>{ static constexpr bool value = true; }; template<class T> struct remove_const { typedef T type; }; template<class T> struct remove_const<const T> { typedef T type; }; template< class T > using remove_const_t = typename remove_const<T>::type; template<class T> struct remove_pointer { typedef T type; }; template<class T> struct remove_pointer<T*> { typedef T type; }; template< class T >
in „C++ Funktions Template für __flash“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Arduino_Hitzdrahtanemometer_Bluetooth.ino
#include<SoftwareSerial.h> SoftwareSerial BT(0,1); // 0 = RX, 1 = TX int sensorPin = A1; // select the input pin for the analog voltage float sensorValue = 0; // variable to store the value coming from the analog input void setup() { // put your setup code here, to run once: BT.begin(38400); //Serial.begin(9600); // don't use BT-transfer and Serial-transfer to the computer at the same time!!! } void loop() { sensorValue = analogRead(sensorPin); sensorValue = sensorValue * 5.0 / 1023; Serial.println(sensorValue); BT.print(sensorValue); BT.print(";"); // don't forget the semicolon at the end of the data
in „Physikprojekte“ · Offtopic ·
-
Datei
UnoInterruptAdc.ino
#include <CombieAdc.h> #include <util/atomic.h> using Combie::Adc; Adc adc; struct Datensatz { Adc::AnalogSource kanal; unsigned long wert; }; constexpr unsigned anzahl {3}; Datensatz messungen[anzahl] { {Adc::MUX_ADC1,0}, {Adc::MUX_ADC0,0}, {Adc::MUX_ADC4,0}, }; unsigned idx {0}; void adcCallBack(int value) { messungen[idx].wert += value; adc.setSource(messungen[idx].kanal); idx++; if(idx >= anzahl) idx = 0; adc.startConversion(); } void setup() { Serial.begin(9600); adc .enable() // .setReference(Adc::REF_11) .setReference(Adc::REF_VCC) .setClockDivisor(Adc::DIV_128) .setSource(messungen[idx].
in „ADC-Kanäle sukzessive abfragen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Page-Write-Test.ino
#include <Wire.h> // I2C #define EXT_EE_ADDR 0x50 // I2C address of 1. external eeprom new 15.05.2025 #define EXT_EE_SIZE 32768 // Max address for 32k-eeprom 22.05.2025 #define EXT_EE_LIMIT 30 // Write buffer limit #define EXT_EE_PAGE 64 // Page size #define EXT_EE_MELODY 0 // Melody data start address in external eeprom #define EXT_EE_CALENDAR 5000 // Calendar data start address in external eeprom 02.06.2025 #define EXT_EE_TEST1 12000 // Test-data 1 start address in external eeprom ++++ 18.06.2025 10000 -> 12000 #define EXT_EE_TEST2 17000 // Test-data 2 start address in external eeprom ++++ 15000
in „Arduino: page-write in I2C eeprom verliert sporadisch ein Byte“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DOGM204_DEMO.ino
#include <Wire.h> #define LCD_ADDR 0x3D // 7-bit Adresse (SA0=VDD) #define RESET_PIN 8 // Zeitvariablen int sekunde = 0, minute = 0, stunde = 0; int tag = 1, monat = 1, jahr = 2025; unsigned long letzteAktualisierung = 0; // Serielle Eingabe String inputBuffer = ""; void lcdCommand(uint8_t cmd, bool cont = false) { Wire.write(cont ? 0x80 : 0x00); // Control Byte: Co=cont, RS=0 Wire.write(cmd); } void lcdData(uint8_t data) { Wire.beginTransmission(LCD_ADDR); Wire.write(0x40); // Control Byte: Co=0, RS=1 Wire.write(data); Wire.endTransmission(); } void setContrast(uint8_t contrast) { // Contrast
in „EA DOGM204 Display Kontrast Regeln“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
FG_250MHz.ino
/* Taktgenerator fuer RP2040 Pico Pi mit Ausgang an GPIO21. Die Frequenz wird in der Arduino IDE eingestellt: hier 250 MHz. 2025-17-07 Michael Nowak www.mino-elektronik.de */ #include"rp2040_arduino.h" // Registerdefinitionen #define BIT(x) (1<<x) void setup() { // put your setup code here, to run once: CLOCKS->CLK_GPOUT0_CTRL = CLOCKS_CLK_GPOUT0_CTRL_ENABLE_Msk | // enable 6 << CLOCKS_CLK_GPOUT0_CTRL_AUXSRC_Pos; // pll_sys als Quelle IO_BANK0->GPIO21_CTRL = IO_BANK0_GPIO21_CTRL_FUNCSEL_clocks_gpout_0; // fester Ausgang PADS_BANK0->GPIO21 |= 3<<PADS_BANK0_GPIO21_DRIVE_Pos | // hoher Ausgangsstrom
in „Gesucht Generator/Oszillator mit fester Frequenz 250 MHz“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
FG_250MHz.ino
/* Taktgenerator fuer RP2040 Pico Pi mit Ausgang an GPIO21. 2025-07-21 Michael Nowak www.mino-elektronik.de */ #include"rp2040_arduino.h" // Registerdefinitionen #define BIT(x) (1<<x) #define DEF_SYSCLOCK 250000000 // default #define MHZ_12 12000000 // default #define MHZ_FAKTOR 1000000 // 1e6 #define REF_DIV 2 #define PLL_DIV1 3 // #define PLL_DIV2 2 // void kurz_warten(void) // fuer kurze Verzoegerungen { volatile int i = 10000; while(i--); } void setup() { // put your setup code here, to run once: VREG_AND_CHIP_RESET_SET-> VREG = 15<<VREG_AND_CHIP_RESET_VREG_VSEL_Pos; while(!(VREG_AND_CHIP_RESET
in „Gesucht Generator/Oszillator mit fester Frequenz 250 MHz“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
Arduino_Geigerzaehler_Poisson.ino
#include <LiquidCrystal_I2C.h> #include <Wire.h> #include <SPI.h> #include <SD.h> LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display. ACHTUNG: Adresse kann auch 0x3F sein !!! // Anschlüsse: // GND - GND // VCC - 5V // SDA - ANALOG Pin 4 // SCL - ANALOG pin 5 const int buttonPin = 8; int buttonState = 0; const byte interruptPin = 2; int pulse = 0; long time_alt; int seconds; int i; int counts[200]; const int chipSelect = 10; // used for Arduino // =========================== // ======= SETUP ========= // =========================== void setup() {
in „Physikprojekte“ · Offtopic ·
-
Datei
ADXL345_Achsenauslesen.ino
#include <SPI.h> const int CS_PIN = 10; void setup() { Serial.begin(115200); pinMode(CS_PIN, OUTPUT); digitalWrite(CS_PIN, HIGH); SPI.begin(); // SCK = 13, MISO = 12, MOSI = 11 SPI.beginTransaction(SPISettings(5000000, MSBFIRST, SPI_MODE3)); //1 MHz //Device ID lesen (soll 0xE5 sein) uint8_t deviceID = readRegister(0x00); Serial.print("Device ID: 0x"); Serial.println(deviceID, HEX); delay(100); writeRegister(0x31, 0x01); //DATA-Format writeRegister(0x2D, 0x08); // Measurement Mode writeRegister(0x2C, 0x0C); // 400 Hz ODR writeRegister(0x38, 0x00); // FIFO aus } void loop() { // X-, Y-, Z-Daten
in „ADXL380 mit SPI auslesen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Arduino_Zufall_01.ino
long i,j,Summe_1, Summe_2; void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: Summe_2 = 0; for(j = 1; j <= 100000; j++) { Summe_1 = 0; i = 0; while(Summe_1 < 1000000) { Summe_1 = Summe_1 + random(1000001); i = i + 1; } Summe_2 = Summe_2 + i; } Serial.println(Summe_2 / 100000.0, 4); }
in „Physikprojekte“ · Offtopic ·
-
Datei
Melody_PROGMEM_all.ino
// **************************************************** // Melodien aus PROGMEM vom 27. 09. 2025 // **************************************************** const PROGMEM char title[] = { // List of text for melody-titles new 30.06.2025 - change number_mel too! "Asa Branca " // 1 Asa Branca 0 text-length 14 all titles full length "Take on me " // 2 Take on me "Starwars " // 3 Starwars "Cantina-Band " // 4 Cantina-Band "Game of Throne" // 5 Game of Thrones "Fuer Elise " // 6 Für Elise "Greensleeves " // 7 Greensleeves "Silent Night " // 8 Silent Night "Happy Birthday" // 9 Happy Birthday "Nokia Ringtone
in „Arduino Uno R4: Besonderheiten und Abhilfen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Serial_Test_4.ino
// // Serial-Test 01.10.2025 // void setup() { Serial.begin(19200); delay(1000); Serial.println("Test serielle Übertragung"); } bool rxStart = 0; bool data = 1; int contBytes = 0; int bufferMax = 0; int serData = 0; int count = 0; int bytes = 0; long timeout = 0; long baud = 0; unsigned long startMicros = 0; unsigned long contMicros = 0; unsigned long totalMicros = 0; unsigned long duration = 0; void loop() { while (Serial.available() || timeout) { if (!rxStart) { startMicros = micros(); } if (Serial.available()) { timeout = 10000; } byte y = Serial.available(); if (y > bufferMax) { bufferMax = y;
in „Arduino Uno R4: Besonderheiten und Abhilfen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Daten_Einlesen_Veit.ino
struct Daten { // static const byte READ_BUFFER_SIZE {20}; static const int READ_BUFFER_SIZE {15000}; // Datentyp und Arraygrösse geändert - Es sollen Dateien bis ca. 10 kB eingelesen werden. char rxBuffer [READ_BUFFER_SIZE + 1] {'\0'}; // Platz für 20 Zeichen + Null-Terminator //byte index {0}; int index {0}; // Datentyp aufgrund Puffergrösse geändert char c {'\0'}; }; Daten meinBuffer; int total = 0; void setup() { Serial.begin(19200); } void loop() { // liefert true wenn das LF eingelesen wurde if (readLine(Serial, meinBuffer)) { Serial.print("Eingelesen: "); Serial.println(meinBuffer.rxBuffer
in „Arduino Uno R4: Besonderheiten und Abhilfen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
IR_KL.ino.txt
// ATMEGA8 mit internen 8MHz-RC-Oszillator // PB0=PA-M104B1, PB1=PB-M104B1, PB2=PC-M104B1, PB3=PD-M104B1, PB4=HIFI-TO, PB5=STBY-M104B1 // PROGRAMM RUNTER PC0 vom ATMEGA8 // PROGRAMM RUNTER PC1 vom ATMEGA8 // LAUTSTÄRKE VERRINGERN PD6 vom ATMEGA8 // LAUTSTÄRKE ERHÖHEN PD5 vom ATMEGA8 // IN BEREITSCHAFT SCHALTEN PD4 vom ATMEGA8 // HIFI-Funktion PD3 vom ATMEGA8 // IR-Diode an PD7 vom ATMEGA8 #define DECODE_NEC #define DECODE_SONY #define DISABLE_CODE_FOR_RECEIVE_PROTOCOLS 1 #include <IRremote.hpp> #define IR_RECEIVE_PIN 7 // IR-Diode an PD7 vom ATMEGA8 // --- Zusätzliche Tastenpins --- #define BTN_PROG_MINUS
in „Alte VFD-Anzeige übrig, möchte gerne eine Uhr damit bauen“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
020_fmes2.ino
/* PIO frequency measurement 2025-10-21 mchris https://www.mikrocontroller.net/topic/580993#7954679 PIO Assembler: https://wokwi.com/tools/pioasm */ #include "fmes.pio.h" // Includes the compiled PIO assembly program for blinking #include <hardware/gpio.h> #include <hardware/pio.h> #include "hardware/clocks.h" #define TESTPIN 16 // Macro for frequency input // function to translate #if defined(ARDUINO_ARCH_MBED) #include <pinDefinitions.h> static int translate_pin(int pin) { return digitalPinToPinName(pin); } #else static int translate_pin(int pin) { return pin; } #endif static PIO pio; static
in „PiPico PIO programmieren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Metalldetektor_b_Arduino.ino
#include <Wire.h> int value = 0; int value_max; long time_start; int impuls = 119; //select the pulse length depending on the frequency int measure_time = 0; int base = 0; void setup() { pinMode(A0, INPUT); pinMode(A1, INPUT); pinMode(8, OUTPUT); pinMode(A4, INPUT); pinMode(A5, OUTPUT); } void loop() { measure_time = analogRead(A4); // determining the measure-time between [0,1023] µsec digitalWrite(8,HIGH); // creating a pulse in the excitation coil with the duration = impuls µs delayMicroseconds(impuls); digitalWrite(8, LOW); value_max = 0; time_start = micros(); while(micros() - time_start <
in „Physikprojekte“ · Offtopic ·
-
Datei
test_std_vector.ino
#include <Arduino.h> std::vector<String> words; void waitForKeyboardReturnKey() { Serial.println("Press any key to continue..."); // Wait until at least one character is available in the buffer while (Serial.available() == 0) { // Do nothing, just wait for input } // Read all available characters in the buffer while (Serial.available() > 0) { Serial.read(); // Clear out the buffer to avoid unintended behavior delay(10); // Small delay to ensure all characters are read } Serial.println("Key pressed, continuing..."); } void setup() { Serial.begin(74880); while (!Serial) { // loop only } } void loop
in „Anfänger-Entwicklung einer Gärbox Steuerung“ · Offtopic ·
-
Datei
PDM300_Simulator.ino
/* Multimeter PDM-300-C2 Simulator What: Arduino-Programm zur Simulation des Multimeters und Übertragung der seriellen Messwerte. Why: Wenn man kein PDM-300-C2 Multimeter hat, kann man statt dessen einen Arduino benutzen, um die PC-Empfängerprogramme zu testen. How: Es wird eine analoger Eingang bemessen und die Daten zum PC übertragen. Das Datenpaket besteht aus 10 Bytes. Die Spannung des Analogeingangs mit einer einmalig gemessenen Referenzspannung berechnet. TBD: use internal Reference 2024-09-20 mchris License: Free Wine License Diskussion: https://www.mikrocontroller.net/topic/571179 https://www.mikrocontroller.net
-
Datei
Motorsteuerung-18-mai.ino
int motor1_A=8; // Motor 1 int motor1_B=9; int motor2_A=6; // Motor 1 int motor2_B=7; const int buttonPin_front = 2; // hier sind drei Butons, bei denen der Roboter die Richtung ändern soll int buttonState_front = 0; const int back_buttonPin_l = 3; int back_buttonState_l = 0; const int back_buttonPin_r = 4; int back_buttonState_r = 0; int myStatus = 1; int raum_position; // Varible, um klar zu machen, ob er linnks oder Rechts ausscheren soll, rechte raumseite= 0 - linke raumpos = 1 #define trigPin 13 // Infrarot sender und Empfg #define echoPin 12 #define relais1 14 // steuert ene Putzwalze, die
in „Arduino uno Staubsaugerboter Variablenproblem“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Struct_receiveLEDTon.ino
#include <RFM69.h> #include <SPI.h> #include <SPIFlash.h> #include "pitches.h" #define NODEID 1 #define NETWORKID 100 #define FREQUENCY RF69_868MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ) #define KEY "PolizeiArduino123" //has to be same 16 characters/bytes on all nodes, not more not less! #define LED 9 #define SERIAL_BAUD 9600 #define ACK_TIME 30 // # of ms to wait for an ack int melody[] = { NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4 }; int noteDurations[] = { 4, 8, 8, 4, 4, 4, 4, 4 }; RFM69 radio; SPIFlash flash(8, 0xEF30); //EF40
in „RFM69HW-Arduino Nano "Funkklingel"“ · HF, Funk und Felder ·
-
Datei
Struct_sendFertig.ino
#include <RFM69.h> #include <SPI.h> #include <SPIFlash.h> #define NODEID 99 #define NETWORKID 100 #define GATEWAYID 1 #define FREQUENCY RF69_868MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ) #define KEY "PolizeiArduino123" #define SERIAL_BAUD 9600 #define ACK_TIME 30 // # of ms to wait for an ack #define LED 9 int TRANSMITPERIOD = 300; //transmit a packet to gateway so often (in ms) byte sendSize=0; boolean requestACK = false; SPIFlash flash(8, 0xEF30); //EF40 for 16mbit windbond chip RFM69 radio; byte anzahl = 0; typedef struct { int nodeId; //store this nodeId
in „RFM69HW-Arduino Nano "Funkklingel"“ · HF, Funk und Felder ·
-
Datei
atmega328sensor.ino
/* funktioniert mir rf24mesh auf raspberry a2: anodeFototransistor 13: grün 12: orange 11: gelb 10: lila 9 : grau 8 : ds1820 (2Draht) RF24 radio(10,9); // funktioniert; grau an 9 und lila an 10 RF24 radio(A1,A0); // test für a0 und a1: funktioniert grau a0 lila a1 */ #include "RF24.h" #include "RF24Network.h" #include "RF24Mesh.h" #include <SPI.h> #include <OneWire.h> #include <DallasTemperature.h> #include "LowPower.h" #define nodeID 1 uint8_t otherNodeID=0; #define LED 10 #define analogPin A2 #define RECEIVER 0 // Data wire is plugged into pin 2 on the Arduino #define ONE_WIRE_BUS A3 // war 8 bool start
in „Arduino Nano Batterieentladespannung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Arduino-DG-int.ino
/* Drehgeberauswertung per Interrupt auf einem AVR: spezielle Version fuer Arduino UNO R3! http://www.mino-elektronik.de Alle Angaben wie immer ohne Gewaehr ! 2014-03-17 modifiziert: 2017-12-13 */ #define BIT(x) (1<<x) #define DEF_BAUDRATE 19200 #define PHASE_A 2 // an PORTD.2 (PCINT18) #define PHASE_B 3 // an PORTD.3 #define MASKE (BIT(PHASE_A)+BIT(PHASE_B)) // vereinfachte Schreibweise volatile int32_t count; // Zaehler per Interrupt int32_t zaehler, alter_zaehler; // Vergleichszaehler fuer neue Ausgabewerte // nur Interrupt PCINT18 (PCINT2-Gruppe) wird zur Auswertung verwendet ISR(PCINT2_vect)
in „BastlerProjekt - Drehgeberauswertung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
WS2812_Display.ino
#include <CharacterEncoding.h> #include <ShiftDisplay.h> #include <Adafruit_NeoPixel.h> #include <RTClib.h> #include <Wire.h> #include <boarddefs.h> #include <IRremote.h> #include <IRremoteInt.h> #include <ir_Lego_PF_BitStreamEncoder.h> #define PIXEL_PIN 9 // Digital IO pin connected to the NeoPixels. #define PIXEL_COUNT 60 // Parameter 1 = number of pixels in strip, neopixel stick has 8 // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_RGB Pixels are wired for RGB bitstream // NEO_GRB Pixels are wired for GRB bitstream, correct for neopixel
in „WS2811 und 74HC595 Zusammen an Arduino steuren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Geburtstag_v6.ino
#include <CharacterEncoding.h> #include <ShiftDisplay.h> #include <Adafruit_NeoPixel.h> #include <RTClib.h> #include <Wire.h> #include <boarddefs.h> #define PIXEL_PIN 9 // Digital IO pin connected to the NeoPixels. #define PIXEL_COUNT 60 // Parameter 1 = number of pixels in strip, neopixel stick has 8 // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_RGB Pixels are wired for RGB bitstream // NEO_GRB Pixels are wired for GRB bitstream, correct for neopixel stick // NEO_KHZ400 400 KHz bitstream (e.g. FLORA pixels) // NEO_KHZ800 800 KHz
in „WS2811 und 74HC595 Zusammen an Arduino steuren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
LED0_test.ino
#include <Wire.h> byte add = 11000100; // addresse byte PWM0 = 00000010; // PWM0 Register wahl byte PWM1 = 00000100; // PWM1 Register wahl byte PSC0 = 00000001; // PSC0 Register wahl byte PSC1 = 00000011; // PSC1 Register wahl byte LS0 = 00000101; // LS0 Register wahl byte LED = 00001110; // PWM0 -> LED 0.. PWM1 -> LED1 byte Daten1 = 10000000; // Daten 1 byte Daten2 = 00001111; // Daten 2 void setup() { Wire.begin(); Wire.beginTransmission(add); Wire.write(LS0); Wire.write(LED); Wire.endTransmission(); Wire.beginTransmission(add); Wire.write(PSC0); Wire.write(Daten1); Wire.endTransmission(); Wire.beginTransmission
in „PCA 9533 mit einem UNO ansteuern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
rotaryled_demo25.ino
#include <Encoder.h> #include <Adafruit_NeoPixel.h> const int NUM_LEDS = 25; // number of leds in strip const int LED_PIN = 5; // pin for led strip const int BRIGHTNESS = 255; // brightness of all leds const int WHEEL_SIZE = 256; // how many entries in the color wheel const boolean MOVE_LIGHT = false; // move one light around or keep all lights on const int ENCODER_PIN_1 = 2; const int ENCODER_PIN_2 = 3; const int ENCODER_BUTTON = 4; Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, LED_PIN, NEO_RGB + NEO_KHZ800); Encoder encoder(ENCODER_PIN_1, ENCODER_PIN_2); int mode = 0; long lastPush =
in „Arduino Probleme beim Moodlight Code“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PAC9533-schreiben.ino
#include <Wire.h> byte Input = B00010000; byte add = B01100010; // addresse byte PWM0 = B00000010; // PWM0 Register wahl byte PWM1 = B00000100; // PWM1 Register wahl byte PSC0 = B00000001; // PSC0 Register wahl byte PSC1 = B00000011; // PSC1 Register wahl byte LS0 = B00000101; // LS0 Register wahl byte LED = B11101110; // PWM0 -> LED 0.. PWM1 -> LED1 byte Daten1 = B10101010; // Daten 1 byte Daten2 = B01010101; // Daten 2 byte Daten3 = B00000101; // Daten 2 byte Daten4 = B01010000; // Daten 2 void setup() { Wire.begin(); Wire.beginTransmission(0x62); Wire.write(0x11); Wire.write(0x97); Wire.write(
in „PCA 9533 mit einem UNO ansteuern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PCA9533-auslesen.ino
#include <Wire.h> void setup() { Wire.begin(); // join i2c bus (address optional for master) Serial.begin(9600); // start serial for output Wire.beginTransmission(0x62); // transmit to device #8 Wire.write(0x10); Wire.endTransmission(); // stop transmitting Wire.requestFrom(0x62,12); // request 6 bytes from slave device #8 while (Wire.available()) { // slave may send less than requested byte c = Wire.read(); // receive a byte as character Serial.println(c,BIN); // print the character } Serial.println("-----------"); } void loop() { delay(500); }
in „PCA 9533 mit einem UNO ansteuern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Ledband_Empf_nger.ino
#include <Wire.h> int br = 0; int redvalue; //Werte für die rXXXgXXXbXXX übergabe int bluevalue; int greenvalue; // Serial Input Variables int intLoopCounter = 0; // String strSerialInput = ""; String strWireInput = ""; // Arduino output pin receiving brightness levels for a specific color #define RED_PIN 6 #define GREEN_PIN 5 #define BLUE_PIN 9 int strobodelay = 40; int pulsatingdelay = 10; int delayfade = 10; int fade = 10; // Delay Time int delay_at_colour = 1000; //Time wich the Fade stay at the Colorvalue // brightness level of each color (0..255) int Brightness_R; int Brightness_G; int Brightness_B
in „Problem mit dem Seriellen Schnittstelle (PC Verbindung)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
bitChainProtokoll.ino
#define WORDLENGTH_IN_BITS 10 #define TIME_QUANTUM_US 40 #define LOW_US (TIME_QUANTUM_US) #define HIGH_US (TIME_QUANTUM_US*2) #define START_US (TIME_QUANTUM_US*4) #define PAUSE_US (TIME_QUANTUM_US*5) #define INPUT_PIN 3 #define OUTPUT_PIN 4 inline void sendPulse(uint16_t t_us) { digitalWrite(OUTPUT_PIN, HIGH); delayMicroseconds(t_us); digitalWrite(OUTPUT_PIN, LOW); } // transmit LSB first inline void sendValue(uint16_t value) { for (int n = 0; n < WORDLENGTH_IN_BITS; n++) { if ((value & 1) == 0) sendPulse( LOW_US ); else sendPulse( HIGH_US ); delayMicroseconds(PAUSE_US); value = value >> 1; } } uint16
in „Kann man ATtinys in Reihe miteinander kommunizieren lassen?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
bitChainProtokoll.ino
#define WORDLENGTH_IN_BITS 10 #define TIME_QUANTUM_US 40 #define LOW_US (TIME_QUANTUM_US) #define HIGH_US (TIME_QUANTUM_US*2) #define START_US (TIME_QUANTUM_US*4) #define PAUSE_US (TIME_QUANTUM_US*5) #define INPUT_PIN 3 #define OUTPUT_PIN 4 inline void sendPulse(uint16_t t_us) { digitalWrite(OUTPUT_PIN, HIGH); delayMicroseconds(t_us); digitalWrite(OUTPUT_PIN, LOW); } // transmit LSB first inline void sendValue(uint16_t value) { for (int n = 0; n < WORDLENGTH_IN_BITS; n++) { if ((value & 1) == 0) sendPulse( LOW_US ); else sendPulse( HIGH_US ); delayMicroseconds(PAUSE_US); value = value >> 1; } } uint16
in „Kann man ATtinys in Reihe miteinander kommunizieren lassen?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sub_Serial_Read.ino
String str; byte num; void setup() { Serial.begin(9600); Serial.println("Bitte stellen Sie Ihren Seriellen Monitor auf 'Kein Zeilenende' ein"); SReadStr(); SReadOneNumber();SReadTwoNumbers(); } void loop() { } void SReadStr() { str=""; Serial.println("Bitte geben Sie einen Text ein: "); do {} while (Serial.available() <1); char nextChar; do { delay(25); nextChar = Serial.read(); str += nextChar;} while (Serial.available()>0); Serial.print("Der String lautet: "); Serial.println( str ); Serial.print("\n"); } void SReadOneNumber() { Serial.println("Bitte geben Sie eine Ziffer zwischen 0 und 9 ein
in „Arduino Serial ganze wörter abfragen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
18-002A.ino
#include <RF24Network.h> #include <RF24.h> #include <RF24Mesh.h> #include <ESP8266WiFi.h> #define _VERSION 1005 uint32_t displayTimer = 0; // NRF24L01+ CE auf GPIO15 / Pin12 RF24 radio(15, 2); // CE, CS RF24Network network(radio); RF24Mesh mesh(radio,network); void setup(void){ WiFi.setAutoConnect ( false ); pinMode(12,OUTPUT); //B pinMode(16,OUTPUT); //R pinMode(14,OUTPUT); //G pinMode(0,OUTPUT); //SCK pinMode(5,INPUT); //MISO pinMode(4,OUTPUT); //MOSI pinMode(2,OUTPUT); //CS pinMode(15,OUTPUT); //CE //pinMode(9, INPUT); //IRQ analogWrite(12,120); analogWrite(14,150); analogWrite(16,200); Serial.begin
in „ESP8266 - Arduino - HTTP Get, ESP stürzt ab.“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
18-002A.ino
#include <RF24Network.h> #include <RF24.h> #include <RF24Mesh.h> #include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #define _VERSION 1005 uint32_t displayTimer = 0; // NRF24L01+ CE auf GPIO15 / Pin12 RF24 radio(15, 2); // CE, CS RF24Network network(radio); RF24Mesh mesh(radio,network); const char* ssid = "M287E09"; const char* password = "123456789"; // Global variables void setup(void){ Serial.begin(115200); Serial.println(); Serial.print("Version: "); Serial.println(_VERSION); Serial.println("Booting Sketch..."); WiFi.setAutoConnect ( false ); while(WiFi.waitForConnectResult() != WL_CONNECTED
in „ESP8266 - Arduino - HTTP Get, ESP stürzt ab.“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
WebStream-web.ino
/* WebRadio Example Very simple HTML app to control web streaming Copyright (C) 2017 Earle F. Philhower, III This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received
in „Webradio basteln“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Atmega328_Interrupt.ino
/* --------------------------------------------------------- * Interrupt Definitionen * -------------------------------------------------------- */ #include <avr/sleep.h> #include <avr/interrupt.h> #include <avr/io.h> volatile int led = 10; // entspricht PB1 volatile int interrupt = 9; //entspricht PB0 /*-------------------------------------------------------------- * Bluetooth Definitionen * ------------------------------------------------------------- */ //#include <Arduino.h> #include <SPI.h> #include "Adafruit_BLE.h" #include "Adafruit_BluefruitLE_SPI.h" #include "Adafruit_BluefruitLE_UART.h
in „Atmega328, Probleme mit Interrupt und Bluetooth“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
AchtfachRelaisSchalten.ino
/** * 8 Taster, gegen GND geschaltet * also invers funktionierend * * 8 Relais auf einer der China üblichen Relaiskarte * ebenfalls invers schaltend * * Die Entprellzeit von 20ms ist in CombieTimer als default * vorgegeben. * * Funktion: * Jeder Tastendruck toggelt den Schaltzustand des zugehörigen Relais. */ #include <CombiePin.h> #include <CombieTimer.h> #include <CombieTools.h> class Task // Interface { public: virtual void init() = 0; virtual void run() = 0; }; template<byte inPin,byte outPin> class Taster2Relais: public Task { private: Combie::Pin::TasterGND<inPin> taster; Combie::Pin::RelaisINV
in „statische Polymorphie per CRTP in Embedded Systemen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Fading_atiny_85.ino
/* Fading This example shows how to fade an LED using the analogWrite() function. The circuit: - LED attached from digital pin 9 to ground. created 1 Nov 2008 by David A. Mellis modified 30 Aug 2011 by Tom Igoe This example code is in the public domain. http://www.arduino.cc/en/Tutorial/Fading */ int ledPin = 4; // LED connected to digital pin 9 void setup() { // nothing happens in setup } void loop() { // fade in from min to max in increments of 5 points: for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5) { // sets the value (range from 0 to 255): analogWrite(ledPin, fadeValue); // wait
in „Arduino as ISP“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pdc_uno_CAN_.ino
#include <mcp_can.h> #include <SPI.h> const int SPI_CS_PIN = 10; MCP_CAN CAN(SPI_CS_PIN); int cm ; void setup() { pinMode(A5,OUTPUT); analogWrite(A5,0); pinMode(A0, INPUT); Serial.begin(115200); Serial.println("restart UNO PDC CAN BUS"); while (CAN_OK != CAN.begin(CAN_500KBPS)) {Serial.println("CAN BUS MCP 2515 / MCP 2562 init fail"); Serial.println(" Init CAN BUS again"); delay(100); } Serial.println("CAN BUS init ok!"); } unsigned char stmp[8] = {0, 0, 0, 0, 0, 0, 0, 0}; void loop() { if ( analogRead(A0)> 400){ Serial.print("r : "); Serial.println(" ON !!!!!!!!!!!!!!!!!!!!"); stmp[0] = 64; }