-
Datei
Kondensatormotor-sin_20200404b.ino
int potipluspin = 12; // atmega pin 18 Poti Pluspol int potischleiferpin = A5; // atmega pin 28 Poti Schleifer Über RC-TP int temppin = A4; // atmega pin 27 Temp-Sensor-Tranistor bool temp; int enuppin = 2; // atmega pin 4, Katode Optoled int enunpin = 3; // atmega pin 5, Katode Optoled int enzppin = 4; // atmega pin 6, Katode Optoled int upin = 9; // atmega pin 15, Anode Optoled int zpin = 10; // atmega pin 16, Anode Optoled int enznpin = 7; // atmega pin 13, Katode Optoled int relaispin = 8; // atmega pin 14 schaltet Relais ein int zwkpin = 13; // atmega pin 19 wird HIGH wenn die Zwischenkreisspannung
in „Arduino Kondensatormotor Drehzahlsteuerung“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
i2c_test.ino
// ********************************************************************************* // defines // ********************************************************************************* #define SW_Version 1.00 #define SDA_PIN 12 #define SCL_PIN 13 // ********************************************************************************* // includes // ********************************************************************************* #include <SoftwareWire.h> #include <Wire.h> #include "FIFO.h" // ********************************************************************************* //BBI2C bbi2c_master; SoftwareWire
in „I2C Bus auftrennen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
SPI_eeprom_lezen_KOSTAL.ino
#define SLAVESELECT 10 // SS #define DATAOUT 11 // MOSI #define DATAIN 12 // MISO #define SPICLOCK 13 // SCK // How to wire the arduino to the M95160 eeprom: // arduino pin - AVR pin - eeprom pin // 10 SS 1 // 11 MOSI 5 // 12 MISO 2 // 13 SCK 6 // VCC VCC 3, 7, 8 // GND GND 4 // //opcodes #define WREN 6 #define WRDI 4 #define RDSR 5 #define WRSR 1 #define READ 3 #define WRITE 2 byte eeprom_output_data; byte eeprom_input_data = 0; byte clr; int address = 0; //data buffer char buffer [128]; char spi_transfer( volatile char data ) { SPDR = data; // Start the transmission while( !( SPSR & ( 1 << SPIF
in „Auslesen, verstehen und programmieren eines F3610M2“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ArduMicroPro_Tablet.ino
#include <stdint.h> //#include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> #endif #define Power_Pin_LED 4 #define colorSaturation 128 #define onboard_LED 2 #define Power_Pin 8 #define Vol_plus 6 #define Vol_minus 5 #define Plat_out_reserve 6 #define LDO_Pin 10 #define ADC_Current_PIN A2 #define ADC_3_3V_PIN A0 #define ADC_5V_PIN A3 #define ADC_V_BAT_PIN A1 #define ADC_Scale_Current 0.6382978f //(2A/3,133333V) <<< 3,1333V=0,1V*4700ohm/150ohm << 0,1V=2A*0,05ohm #define ADC_Scale_Voltage 2.0f //alle Spanungsteiler Faktor 2 uint16_t Val_ADC_Current_raw; uint16_t Val_ADC_3_3V_raw; uint16
in „Anleitung - Bedienpanel - 10Zoll fullHD (FIRE HD10 Mod)“ · Haus & Smart Home ·
-
Datei
attiny_low_power_cutoff.ino
#include <avr/sleep.h> #include <avr/wdt.h> #include <EEPROM.h> #define FET_PIN 4 #define BTN_PIN 3 #define STAT_LED_PIN 1 #define BTN_THRESHOLD 3000 bool curent_btn_state = false; bool previous_btn_state = false; bool ready_2_call = true; unsigned long last_press_time = 0; unsigned long released_time = 0; double voltage_threshold = 0; double hysterese = 0.2; void setup() { pinMode(FET_PIN, OUTPUT); pinMode(STAT_LED_PIN, OUTPUT); pinMode(BTN_PIN, INPUT_PULLUP); pinMode(0,INPUT_PULLUP); pinMode(1,INPUT_PULLUP); //unused pins (p. 57) EEPROM.get(0, voltage_threshold); //reads voltage_threshold from
in „Tiefentladungsschutz mit Attiny und P-Kanal Fet“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Lidar_per_pedes_vier.ino
/* * Board: ESP 32 38 Pin * * Ydlidar <-> ESP32 38 Pin * 1 (+5V, red) <-> 5V * 2 (TX, green) <-> GPIO 16 (RX verbunden mit TX des Lidar) * 3 (RX, yellow) <-> GPIO 17 (TX verbunden mit RX des Lidar) * 4 (GND, black) <-> GND * 5 (M_SCTR, nc) <-> IO ? Motor speed control (noch nicht verbunden) * 6 (M_DEV, nc) * 7 (M_EN, blue) <-> GPIO 22 Motor enable * 8 (NC, nc) * * Author: Wilfried * History: * started: 02.04.2024 finished: * This sketch was created with Arduino IDE 1.8.16. */ #include <HardwareSerial.h> #include "LidarFunctions.h" #define RXD2 16 #define TXD2 17 const int ydlidar_en_pin = 4 ; //
in „YDLidar X4 Pro an Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_speed_cadence_final.ino
//#define DEBUG_PRINT #define SIGNAL_PIN 8 // (Speed) Beliebigen Pin hier setzen (z. B. 8, 9, A0, etc.) #define CADENCE_PIN 3 // This is fixed for IRQ #define BRAKE_PIN 5 // Connection to ebike-Controller #define LED_PIN 13 // ON: Motor allowed #include <avr/io.h> #include <avr/interrupt.h> // Hilfs-Makros zur Auflösung von Arduino-Pins in Register-Zugehörigkeiten #if (SIGNAL_PIN >= 0 && SIGNAL_PIN <= 7) // Digital 0–7 = PORTD #define PCINT_VECTOR PCINT2_vect #define PCICR_BIT PCIE2 #define PCMSK_REG PCMSK2 #define PIN_REG PIND #define PIN_BIT SIGNAL_PIN #define PCINT_BIT SIGNAL_PIN #elif (SIGNAL_PIN
in „E-Bike legalisieren (PAS+Speed->Gas)“ · Fahrzeugelektronik ·
-
Datei
10.split_text.046.ino
/* LICENCE see end of file */ /* --->>> Version number <<<--- Don't forget to update the version number in the private section of the class! */ #ifndef DUMMY // Mandatory Preprocessor Items ================================= // Meta items --------------------------------------------------------------- #ifndef _10_SPLIT_TEXT_IS_STANDALONE #define _10_SPLIT_TEXT_IS_STANDALONE true // If running as a standalone #endif // _10_SPLIT_TEXT_IS_STANDALONE // REQUIRED IN GLOBAL SPACE ================================================! String textToSplit; // Reserved long String to avoid heap fragmentation
in „Flexible SplitText() Klasse (Anfänger)“ · Projekte & Code ·
-
Datei
Page_Write_Test_ohne_Log.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
Page_Write_Test_ohne_Log.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
port_read_filt_irq.ino
const uint8_t MONITOR_MASK = 0b11111111; // Überwache D0–D7 volatile uint16_t ringBuffer[8] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}; volatile uint8_t sum[8] = {16, 16, 16, 16, 16, 16, 16, 16}; volatile bool portDLow = 0b00000000; volatile bool portDHigh = 0b11111111; ISR(TIMER1_COMPA_vect) { uint8_t portValue = PIND & MONITOR_MASK; // z. B. D2–D7 for (uint8_t i = 0; i < 8; i++) { if (!(MONITOR_MASK & (1 << i))) continue; uint8_t newBit = (portValue >> i) & 1; uint8_t oldBit = (ringBuffer[i] & 0x8000) ? 1 : 0; // Ältestes Bit extrahieren (MSB) ringBuffer[i] = (ringBuffer[i
in „24V 1ms Impuls verlängern“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
10.split_text.058.ino
/* LICENCE see end of file! */ /* Environemental note The program is created for Arduino/ESP8266 and is tested on WIN10 only! */ /* --->>> READ THIS: <<<--- Developer, don't forget to update the version number in the private section of the class! */ #ifndef DUMMY // Mandatory Preprocessor Items ================================= // Meta items --------------------------------------------------------------- #ifndef _10_SPLIT_TEXT_IS_STANDALONE #define _10_SPLIT_TEXT_IS_STANDALONE true // If running as a standalone #endif // _10_SPLIT_TEXT_IS_STANDALONE // REQUIRED IN GLOBAL SPACE ================
in „Flexible SplitText() Klasse (Anfänger)“ · Projekte & Code ·
-
Datei
Arduino_Geigerzaehler_Poisson_Testgenerator.ino
#include <LiquidCrystal_I2C.h> #include <Wire.h> #include <SPI.h> int outputPin = 2; 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 // =========================== // ======= SETUP ========= // =========================== void setup() { Serial.begin(9600); lcd.begin(); // initialize the lcd lcd.backlight(); lcd.setCursor(0,0); lcd.print("Geigerzaehler"); lcd.setCursor(0,1); lcd.print("Generator"); pinMode(outputPin, OUTPUT
in „Physikprojekte“ · Offtopic ·
-
Datei
FC10_Split_text.ino
/* LICENCE see end of file! */ /* Environemental note The program is created for Arduino/ESP8266 and is tested on WIN10 only! */ /* --->>> READ THIS: <<<--- Developer, don't forget to update the version number here! */ // File main control ---------------------------------------------------------- #pragma once // Use this file only once to avoid redefinition problems class SplitText { /** * @class SplitText * @brief Utility class for identifying start and end indices of "words" * within a text using protected and non-protected delimiters. * * This class is a helper class to OledPrint and processes
in „Flexible SplitText() Klasse (Anfänger)“ · Projekte & Code ·
-
Datei
arduinoI2Cbridge.ino
#include <Wire.h> const uint8_t I2C_ADDRESS = 0x58; String inputBuffer = ""; void setupClock8MHz() { pinMode(9, OUTPUT); // Stop Timer1 TCCR1A = 0; TCCR1B = 0; TCNT1 = 0; // Toggle OC1A on compare match TCCR1A = _BV(COM1A0); // Set timer mode to CTC (Clear Timer on Compare Match) with OCR1A as TOP TCCR1B = _BV(WGM12); OCR1A = 0; // Compare value // No prescaling -> timer counts at 16 MHz CPU clock TCCR1B |= _BV(CS10); } void setup() { Wire.begin(); Serial.begin(9600); while (!Serial); Serial.println("Serial-to-I2C bridge. Commands:"); Serial.println("W 0x10 0x1234"); Serial.println("R 0x10"); Serial.println
in „Pollin PMT-Modul“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_sep21d.ino
#include "util/atomic.h" unsigned long mymillis = 0; int main (void) { const unsigned long eventInterval = 1000; unsigned long previousTime = 0; DDRB |= (1 << PB5); TCCR1B |= (1 << WGM12); // Configure timer 1 for CTC mode TIMSK1 |= (1 << OCIE1A); // Enable CTC interrupt OCR1A = 7999; // Set CTC compare value to 1 Hz at 8 MHz AVR clock , with a prescaler of 256 TCCR1B |= (1 << CS00); // Start timer at F_CPU /256 sei (); // Enable global interrupts while (1) { // Updates frequently unsigned long currentTime; ATOMIC_BLOCK(ATOMIC_RESTORESTATE) currentTime = mymillis; // This is the event if (currentTime
in „Versuch einer Millis Funktion für AVR“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Melody_ARM_aus_EEPROM_all.ino
// **************************************************** // Melodien aus EEPROM 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
sketch_sep28d.ino
#include <Streaming.h> // die Lib findest du selber ;-) Print &cout = Serial; // cout Emulation für "Arme" // constexpr int melody[] // Globale Variablen verwenden 6744 Bytes // int melody[] // Globale Variablen verwenden 7080 Bytes const int melody[] // Globale Variablen verwenden 6744 Bytes { 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, 1,4,6,8,22,5, }; void setup() { delay(6000); Serial.begin(9600); cout << F("Start: ") << F(__FILE__) << endl; for(auto data: melody
in „Arduino Uno R4: Besonderheiten und Abhilfen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Beispiel_ESP32_ledc.ino
#include <Streaming.h> #include <ranges> constexpr unsigned milliSec {3}; constexpr bool DEBUG {false}; namespace MeineLed { constexpr unsigned frequency {5000}; // Hz constexpr unsigned resolution {10}; // Bit, 0...255 / 0...1023 /* const unsigned dimLed [] {0,0,0,0,0,0,0,0, 1,1,1,2,2,2,3,3,4,5,6,7,8,10,11,13,14,16,18,21,23,25,28,31,34, 37,40,43,47,51,55,59,63,67,72,77,82,87,93,98,104,110,116,123, 129,136,143,150,158,166,173,182,190,199,207,216,226,235,245,255}; */ const unsigned dimLed [] {0,0,0,0,0,0,0,0,1,1,1,2,2,3,3,4,5,6,7,8,9,10,11,13,14,16,18,19,21,23,26,28,30, 33,35,38,41,44,47,50,54,57,61,64,68,72,77,81,85,90,95,100,105,110,115,121
in „Arduino-ESP32 LEDC API ledcAttach() resolution“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_aug29d.ino
int main() { constexpr byte a {0x11}; DDRB = a; PORTB = a; constexpr byte b {0x55}; DDRB = b; PINB = b; PINB = 0x01; PORTB = 0xAA; while(1){} }
in „Probleme mit High- und Low-Eingängen Arduino Nano“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DL-Bus_lesen_Test.ino
/* Code auf Basis von Harald Peters: https://www.mikrocontroller.net/topic/134862#postform Mit folgenden Modifikationen: https://www.mikrocontroller.net/topic/134862#3991115 Wenn der 328 doppelt so schnell läuft, dann verdoppeln sich auch die Zählerwerte. Für die Dekodierung von DL braucht man hier nur den Timer0. Also bei 16MHz gilt: if (TCNT0>160 || TIFR0 ) // 2048us dann 2x OCR0A = 95; // 1536us und dann OCR0A = 127; // 2048us, für Bits1..8 wirksam Die Werte habe ich hier korrigiert, da ich ursprünglich vergessen hatte, daß die resultierende Frequenz bei CTC (f/OCR0A+1) ist. Aber so kritisch
in „UVR 1611 (TA), Auswertung DL, Mega88, WinAVR“ · Projekte & Code ·
-
Datei
-
Datei
solar_light_tracker_8_.ino
/*************************************************************************** * Solar light tracker project with Mega 2560 R3 Board microcontroller, * * Solar panel, LDR resistors, 0.96 inch OLED 128X64 pixels display, * * ULN2003 modules and 28BYJ-48 step by step motors. * * * * Miguel Torres Gordo * * Getafe (Madrid) - ESPAÑA Last revisión 22-06-2022 * ***************************************************************************/ /************** OLED display library and configuration *************/ #include <Wire.h> // I2C communication library. #include <Adafruit_GFX.h> // Core graphics library
in „Code Solartracker“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Waage_03_12_2024.ino
#include <ModbusRTUSlave.h> #define MODBUS_SERIAL Serial1 #define MODBUS_BAUD 9600 #define MODBUS_CONFIG SERIAL_8N1 #define MODBUS_UNIT_ID 100 #if (defined(ARDUINO_NANO_RP2040_CONNECT) && !defined(ARDUINO_ARCH_MBED)) || defined(ARDUINO_NANO_ESP32) // These boards operate unsing GPIO numbers that don't correspond to the numbers on the boards. // However they do have D# values #defined to correct this. const int8_t buttonPins[2] = {D2, D3}; const int8_t ledPins[4] = {D5, D6, D7, D8}; const int8_t dePin = D13; #else // Other boards do not have D# values, and will throw an error if you try to use them
in „RS232 ASCII Signal zu Modbus RTU RS485 umwandeln“ · Digitale Signalverarbeitung / DSP / Machine Learning ·
-
Datei
sketch_apr15a.ino
#define W5100 #ifdef W5100 #include <SPI.h> // needed for Arduino versions later than 0018 #include <Ethernet.h> #include <EthernetUdp.h> // UDP library from: bjoern@cs.stanford.edu 12/30/2008 #else #include <EtherCard.h> #include <IPAddress.h> #endif int test123; #ifdef W5100 EthernetUDP udp; #endif #ifdef W5100 #else static void homePage (BufferFiller& buf) { buf.emit_p(PSTR("<title>tttt</title>" "<h2>123</h2>" "<a href='c'>Configure</a> - <a href='s'>Send Packet</a>" "<h3>xyz</h3>" "<pre>")); } #endif void EthernetReceiveUDP(){ #ifdef W5100 // packetLoop(); #else uint16_t plen; uint16_t packetSize
in „#ifdef includes und funktionsdeklarationen (arduino)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
mcp4726_mcp4812.ino
// Include libraries this sketch will use #define F_CPU 18432000 #define TWI_FREQ 400000L #include <Wire.h> #include <MCP47X6.h> // Instantiate objects used in this project MCP47X6 theDAC=MCP47X6(MCP47X6_DEFAULT_ADDRESS); void setup() { // TWBR = 12; // 400 kHz (maximum) Serial.begin(9600); // Open serial connection to send info to the host Wire.begin(); while (!Serial) {} // wait for Serial comms to become ready Serial.println("Starting up"); Serial.println("Testing device connection..."); Serial.println(theDAC.testConnection() ? "MCP47X6 connection successful" : "MCP47X6 connection failed");
in „arduino I2C abschalten“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Stoppuhr_IR_V2.ino
/** * Stoppuhr * 18. Mai 2015. * Autor: Philipp Gressly Freimann (phi@gress.ly) * * * Original aus der "LiquidCrystal Library: hello world" * Originalautoren: Davis A. Mellis, Limor Fried und Tom Igoe * Ergänzung zu einer Stoppuhr (philipp gressly freimann) * * Zwei Buttons: Start (PIN 7) und Stopp (PIN 8) steuern * das verhalten. LCD-Pins (rechts Arduino Leonardo): LCD 1 GND 2 5V (aus Arduino) 3 zur Mitte eines 1k Ohm Drehreglers (= Kontrast) Diesen habe ich mit 1.2k Ohm zum 5V und mit einem 130 Ohm zum GND verbunden. Total ca. 2.33kOhm Total also 4 zu Arduino PIN 12 5 GND 6 zu Arduino PIN 11
in „Kontinuierliches 38kHz Signal empfangen für Lichtschranke über die Straße“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
PCM-Audio-SD-Card.ino
/* Arduino PCM audio playback from SD card This example reads an uncompressed PCM wave file from a micro-SD card plays it back using a PWM output. Created 11 November 2017 by Falk Brunner */ // include the necessary libraries #include <SPI.h> #include <SD.h> #include <avr/interrupt.h> // pin definition for the MEGA256 #define SD_CS 53 #define PWM_OUT 11 // OC1A, PB5 #define ERROR_LED 46 #define F_AUDIO 8000 // /Hz #define BUFFER_SIZE 50 #define PWM_PERIOD ((F_CPU/(8L*F_AUDIO))-1) char filename[] = "test_8k.wav"; File myFile; uint32_t filesize; uint8_t pcm_buffer[2][BUFFER_SIZE]; // audio buffer with
in „Arduino Nano, SD Card, PCM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_dec08a.ino
int S1 = 6; int OU1 = 7; int OU2 = 8; void setup() { pinMode(S1,INPUT); pinMode(OU1,OUTPUT); pinMode(OU2,OUTPUT); enum {Idle,S1ON,S1OFF} state = Idle; } void loop() { switch (state) { case idle: if(S1 == HIGH) { case = S1ON; } if(S1 == LOW) { case = S1OFF; } case S1ON: digitalWrite(OU1,HIGH); delay(500); digitalWrite(OU2,HIGH); if(S1 == LOW) { case = idle; } case S1OFF: digitalWrite(OU2,LOW); delay(1000) digitalWrite(OU1,LOW); if(S1 == HIGH) { case = idle; } } } }
in „Schalter mit Verzögerung programmieren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Treppenbeleuchtung-WS2812B.ino
#include <Adafruit_NeoPixel.h> #include <Wire.h> #ifdef __AVR__ #include <avr/power.h> #endif /*******************************Variablendeklaration***********************************/ int Melder_unten = 22; // Input Bewegungsmelder unten int Melder_oben = 23; // Input Bewegungsmelder oben int Nanopixel = 6; // Output für NanoPixel LEDs int VZ = 15; // Verzögung Ansteuerung der Stufen int Dauer = 30000; // Leuchtdauer wenn alle Stufen angesteuert sind int Sperrzeit = 60000; // Sperrzeit bevor die Scheife beendet wird und die anderen Laufen kann bool BWU,BWO; float PIXEL; #define NUMPIXELS 394 // Anzahl
in „Dynamischer Variablenname in Scheife hochzählen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
7seg_Basic_1.ino
/* Basic usage example Demonstrated some of the basic functionality of the library. Initialize the display, set the backlight brightness, print some text, count from 0 to 100 and print on display and blink some text. Note: make sure to set your serial monitor to line end: NEW LINE! The circuit: * connect TM1637 pin CLK to Arduino pin D4 * connect TM1637 pin DIO to Arduino pin D5 * connect TM1637 pin Vcc to Arduino pin 5V * connect TM1637 pin GND to Arduino pin GND Created 25 September 2015 By Bram Harmsen https://github.com/bremme/arduino-tm1637 */ // include the SevenSegmentTM1637 library #include
in „5 mal TM1637 am uno, adresse?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Test_4_relais_MCUmode.ino
/********************************************************************************** * Home Automation with Alexa and NodeMCU * WeMos smart devices emulation using FAUXMOESP Library * * Code based on the great open source lib & example code at: * http://tinkerman.cat/emulate-wemo-device-esp8266/ * which is based off of the Python example code by: * https://github.com/makermusings/fauxmo * * Also, thanks to Sid for Sid's E Classroom * https://www.youtube.com/c/SidsEClassroom * * fauxmoESP is a library for ESP8266-based devices that emulates a Belkin WeMo device * and thus allows you to control them
in „MCU Mode Programm mit Taster steuern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_jan16a.ino
#include <Basecamp.hpp> #include <esp_deep_sleep.h> //#define BUTTON_PIN1_BITMASK 0x0200000000 // 2^33 in hex #define BUTTON_PIN1_BITMASK 0x0070000000 //#define BUTTON_PIN_BITMASK 0xFF00000000 // all pins RTC_DATA_ATTR int bootCount = 0; Basecamp iot; void print_wakeup_reason() { esp_deep_sleep_wakeup_cause_t wakeup_reason; wakeup_reason = esp_deep_sleep_get_wakeup_cause(); if(wakeup_reason==2) { String pin = String(print64(esp_sleep_get_ext1_wakeup_status())); char __pin[sizeof(pin)]; pin.toCharArray(__pin, sizeof(__pin)); iot.mqtt.publish("klingel/test", 1, true, __pin); } } int print64(uint64_t number
-
Datei
sketch_feb13a.ino
#include <Basecamp.hpp> Basecamp iot; void setup() { pinMode(25, INPUT); pinMode(26, INPUT); pinMode(27, INPUT); Serial.begin(115200); iot.begin(); iot.mqtt.onConnect(transmitStatus); //iot.mqtt.onPublish(suspendESP); } void transmitStatus(bool sessionPresent) { iot.mqtt.publish("klingel/test", 1, true, "start"); } void loop() { if(digitalRead(25)==HIGH){ iot.mqtt.publish("klingel/value", 1, true, "EG"); } if(digitalRead(26)==HIGH){ iot.mqtt.publish("klingel/value", 1, true, "OG1"); } if(digitalRead(27)==HIGH){ iot.mqtt.publish("klingel/value", 1, true, "OG2"); } //delay(500); }
-
Datei
Funkuhr-2-ELV-Modul.ino
#include "DCF77.h" #include "Time.h" #define DCF_PIN 2 // Connection pin to DCF 77 device #define DCF_INTERRUPT 0 // Interrupt number associated with pin #define PIN_LED 5 //time_t time; DCF77 DCF = DCF77(DCF_PIN, DCF_INTERRUPT, false); // wurde ein gueltiges Signal gefunden bool g_bDCFTimeFound = false; void setup() { Serial.begin(57600); pinMode(PIN_LED, OUTPUT); DCF.Start(); Serial.println("Warten auf DCF77 Zeit ... "); Serial.println("Das dauert mindestens zwei Minuten bis die Uhr gestellt wird."); } void loop() { // delay(950); // das Signal wird jede Sekunde abgefragt delay(1000); digitalWrite
in „DCF77 von ELV“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_may03a.ino
const byte numChars = 32; char receivedChars[numChars]; // an array to store the received data boolean newData = false; void setup() { // put your setup code here, to run once: 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(10,OUTPUT); //CE pinMode(9, INPUT); //IRQ Serial.begin(115200); Serial.println(); } void loop() { // put your main code here, to run repeatedly: uint8_t spival = 0; while(1) { recvWithEndMarker(); if (newData == true) { Serial.print(" -Received: ");
in „NRF24L01 (SPI Problem) sendet nur Status“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
SerialToSerialBT.ino
//This example code is in the Public Domain (or CC0 licensed, at your option.) //By Evandro Copercini - 2018 // //This example creates a bridge between Serial and Classical Bluetooth (SPP) //and also demonstrate that SerialBT have the same functionalities of a normal Serial //Dieses Beispiel erstellt eine Brücke zwischen seriellem und klassischem Bluetooth (SPP) //und demonstrieren Sie auch, dass SerialBT die gleichen Funktionen wie eine normale Serial hat #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run
in „ESP32 D1 MINI als Bluetooth Master“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Pluggit_Drucksensorboard_V4.ino
// Ersatzboard Drucksensor für Pluggit V4 // https://www.mikrocontroller.net/topic/477458 // Eingesetzer Controller: ATTINY85 / 1MHz int // Sensoren: 2 Stück Sensirion SDP-810-500Pa // Erstellt: 15.08.21 Daniel F. // neu V2: Testfunktion um beide Ausgänge auf 10V zu schalten // neu V2: Dämpfung des Sensorsignals // neu V3: PWM nun auf Pins 9&10 mit 12bit Auflösung // neu V3: Nachbildung auch von der neueren SDP1000-L05-Platine wenn Pin2 auf GND gesetzt ist // neu V4: Umstellung auf ATTINY85 const int PWM10VS1 = 3960; //PWM(0...4095) für Justage 10V-Ausgangsspannung Sensor1 (Abgleich Analogschaltung
in „Eigenentwicklung Ersatzplatine Drucksensorboard für Pluggit“ · Haus & Smart Home ·
-
Datei
74HC165_neu.ino
#include <ShiftIn.h> #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> // Required for 16 MHz Adafruit Trinket #endif #define PIN 6 #define NUMPIXELS 18 Adafruit_NeoPixel Pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); int LED_Ausgabe[8][4]= //Belegung Feld - LED { {0,1,6,7}, //A3 {1,2,7,8}, //A4 {2,3,8,9}, //A5 {4,5,12,13}, //B1 {5,6,13,14}, //B2 {6,7,14,15}, //B3 {7,8,15,16}, //B4 {8,9,16,17} //B5; }; int LED_Ausgabe_1[8][4]= //Belegung Feld - LED { {0,1,6,7}, //A3 {1,2,7,8}, //A4 {2,3,8,9}, //A5 {4,5,12,13}, //B1 {5,6,13,14}, //B2 {6,7,14,15}, //B3 {7,8,15,16
in „Switch-Case Anweisung - Frage“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
74HC165_neu.ino
#include <ShiftIn.h> #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> // Required for 16 MHz Adafruit Trinket #endif #define PIN 6 #define NUMPIXELS 18 Adafruit_NeoPixel Pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); int LED_Ausgabe[8][4]= //Belegung Feld - LED { {0,1,6,7}, //A3 {1,2,7,8}, //A4 {2,3,8,9}, //A5 {4,5,12,13}, //B1 {5,6,13,14}, //B2 {6,7,14,15}, //B3 {7,8,15,16}, //B4 {8,9,16,17} //B5; }; int LED_Ausgabe_1[8][4]= //Belegung Feld - LED { {0,1,6,7}, //A3 {1,2,7,8}, //A4 {2,3,8,9}, //A5 {4,5,12,13}, //B1 {5,6,13,14}, //B2 {6,7,14,15}, //B3 {7,8,15,16
in „Switch-Case Anweisung - Frage“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Status_LED_Final_1.ino
#include <ShiftIn.h> #include <Adafruit_NeoPixel.h> #define PIN 5 #define NUMPIXELS 40 Adafruit_NeoPixel Pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); int LED_Ausgabe[8][4] = //Belegung Feld - LED { {0, 1, 6, 7}, //A3 {1, 2, 7, 8}, //A4 {2, 3, 8, 9}, //A5 {4, 5, 12, 13}, //B1 {5, 6, 13, 14}, //B2 {6, 7, 14, 15}, //B3 {7, 8, 15, 16}, //B4 {8, 9, 16, 17} //B5; }; // Init ShiftIn instance with a single chip ShiftIn<1> shift; int Schalter_ID = 0; int laenge_Input = 0; void setup() { Serial.begin(9600); Pixels.begin(); Pixels.show(); // declare pins: pLoadPin, clockEnablePin, dataPin
in „Switch-Case Anweisung - Frage“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_oct11d.ino
#include <TaskMacro.h> const byte Actuator_1 = 5; const byte Actuator_2 = 6; unsigned long loops = 0; Task schrittKette(const byte pin_1, const byte pin_2) { taskBegin(); pinMode(pin_1, OUTPUT); pinMode(pin_2, OUTPUT); while(1) { digitalWrite(pin_1, 1); taskPause(5000); digitalWrite(pin_1, 0); taskPause(5000); digitalWrite(pin_2, 1); taskPause(5000); digitalWrite(pin_2, 0); taskPause(5000); } taskEnd(); } Task showLoops(unsigned long &loops) { taskPriority(10000); taskBegin(); for(;;) { taskPause(1000); Serial.print("Loops pro Sekunde: "); Serial.println(loops); loops = 0; } taskEnd(); } void setup
in „Schrittkette“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_dec14b.ino
#include "test.h" void setup() { Serial.begin(9600); Serial.print(test); } void loop() { }
in „Atmega hängt sich auf“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
EPaper_1_54_Test.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 „Fragen zu Waveshare e-paper 1.54"“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Puls_Pause_WDT_85.ino
/* PULS-PAUSE-Timer per WDT vom ATtiny25/45/85 Es wird ein '0'-Ausgangssignal an PB3 erzeugt, welches für 10 Minuten aktiv bleibt. Danach werden ca. 60 Tage angewartet, bis ein neuer Impuls ausgegeben wird. Die Genauigkeit des Timimgs liegt bei ca. 1-2 %. Die Stromaufnahme beträgt etwa 7 µA @ 5 V. Michael Nowak www.mino-elektronik.de 2022-01-08 */ #include <avr/io.h> #include <avr/interrupt.h> #include <avr/sleep.h> #define BIT(x) (1<<x) #define PRO_STUNDE 860UL // Aufrufe des WDT pro Stunde bei 4 s #define PRO_TAG (PRO_STUNDE*24) #define ANZAHL_TAGE 60 #define OUT1_PIN BIT(3) // PB3 #define PULS (PRO_STUNDE
in „Schaltung, die alle zwei Monate einschaltet mit nahezu ohne Stromverbrauch“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Puls_Pause_WDT_85.ino
/* PULS-PAUSE-Timer per WDT vom ATtiny25/45/85 Beim Programmstart werden die beiden Ausgaenge POS_AUSGANG und NEG_AUSGANG für die Zeit PULS aktiviert. Hier sind es 10 Minuten. Danach werden ca. 60 Tage angewartet, bis neue aktive Impuls ausgegeben wrden. Die Genauigkeit des Timimgs liegt bei ca. 1-2 %. Die Stromaufnahme betraegt etwa 7 µA @ 5 V. Michael Nowak www.mino-elektronik.de 2022-01-09 */ #define nKURZZEITTEST #include <avr/io.h> #include <avr/interrupt.h> #include <avr/sleep.h> #define BIT(x) (1<<x) #define PRO_STUNDE 860UL // Aufrufe des WDT pro Stunde bei 4 s #define PRO_TAG (PRO_STUNDE
in „Schaltung, die alle zwei Monate einschaltet mit nahezu ohne Stromverbrauch“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
myencoder_Timer2_INT.ino
/******************************************************************* * Drehencoder aus dem DDS-Projekt in Assembler auf c übersetzt * vorzugsweise für Anwendung in Arduino Jan 2022 R. Drabek * Basis jedenfalls von peda und Hannes Lux * Mit Timer2 Interrupt ca. 1 ms. Timer0 funktioniert nicht, * wenn man die millis() Funktion von Arduino benutzt * Encoder an PortD in Arduino fragt, wichtig, "gleichzeitig" * beide Phasen des Encoders ab. * Die LUT kann ggfs an den verwendeten Encoder angepasst werden, * bzw auch gespiegelt werden wen li, re vertauscht ist * Mit Arduino ist keine spezielle library
in „nochmal Drehencoder“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
MT174_Logger_OPEN.ino
/** * DTZ EEG Logger * Version 3.5 for ISKRA MT174 * 16.02.2022 P. Rebesky * author Creator P.Rebesky * Copyright (©): 2020-2022 by Peter Rebesky * This code can use in private cases only. Every business or companies using of this codes or codes parts is required an approval of us (me) * Every private use can exchange some parts of code or modify some code-lines. This code can change for private use only. * This software is basicly owned by Peter Rebesky and any comercial use is forbidden without approval of us (me). **/ #include <ESP8266WiFi.h> //ESP8266 Core WiFi Library #include <ESP8266WiFiMulti.h
in „Digitale Stromzähler auslesen und in DB speichern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Ampel-Servo-Touch-test.ino
//getest und funktioniert 23.2.22 #include <Servo.h> const int led_g = 12; // LED grün co nst int led_r = 10; // LED rot const int tSensor = 2; // Sensor pin const int sigpin = 9; // servo signal int i=0; bool touch=LOW; Servo myservo; // servo object definiert void setup() { pinMode(tSensor, INPUT); pinMode(led_r, OUTPUT); pinMode(led_g, OUTPUT); myservo.attach(sigpin); // servo on pin 6 myservo.write(90);myservo.write(0); // servo Funktion testen } void loop() { // basic state circuit open, switch not touch // warten aud Sensor Input if (touch= digitalRead(tSensor) ==1) { i=i+1; if (i%2==0){
in „Erdung Arduino Nano merkwürdiges Verhalten“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
shinebar_artnet-to-dmx.ino
#include <Artnet.h> #include <ArtnetEther.h> #include <ArtnetWiFi.h> #include <Conceptinetics.h> bool debug = true; //debug via Serialmonitor //DMX INIT #define DMX_SLAVE_CHANNELS 512 #define RXEN_PIN 2 DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS ); #define dmxaddr 1 bool dmxinit = true; const String target_ip = "192.168.186.90"; // Ethernet stuff const IPAddress ip(192, 168, 186, 91); const IPAddress ip2(192, 168, 186, 90); uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; ArtnetSender artnet; int universe = 0; int value = 0; const uint32_t uni = 0; const uint8_t net = 0; const uint8_t sub = 0; uint8
in „Arduino DMX->Artnet Übertrager“ · Mikrocontroller und Digitale Elektronik ·