-
Datei
shift_in_out.ino
#define SlaveSelect 13 #define DataIn 14 #define DataOut 15 #define Clock 16 char shiftInArduino() { char value = 0; char i; for (i = 0; i < 8; ++i) { digitalWrite(Clock, true); value |= digitalRead(DataIn) << (7 - i); digitalWrite(Clock, false); } return value; } char shiftIn() { char value = 0; char i; for (i = 0; i < 8; ++i) { value |= digitalRead(DataIn) << (7 - i); digitalWrite(Clock, true); digitalWrite(Clock, false); } return value; } char SPIShiftIn165() { // USIDR = p; USISR = 1 << USIOIF; while ((USISR & (1 << USIOIF)) == 0) { USICR = (1 << USIWM0) | (1 << USICS1) | (1 << USICLK) | (1
in „ATtiny2313 USI und 74HC165“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
TargetControl.ino
void TargetControl(int second, int minute, int hour, int day, int month, int year, int dayOfWeek){ if (digitalRead(manualModeOnOffPin)!=HIGH && FirstIterationAfterArduinoReset!=0 && joystickModeOnOff!=1){ ///////////////////////////////////////////////////////////////////////////// //PROGRAM THE TARGETS HERE ////////////////////////////////////////////////////////////////////////////// //READS POTENTIOMTER int analogReading = int(float(analogRead(A2))/10.0)*10; delay(500); int analogReading2 = int(float(analogRead(A2))/10.0)*10; while(abs(analogReading-analogReading2)>35){ delay(500); analogReading
in „Heliostatensteuerung mit Arduino Uno“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
MoveMachine.ino
void moveMachine(float preTargetAlt, float preTargetAz, float targetalt, float targetaz, int sunTrackerOrHelio, float altGearRatio, float altMotorDirection, float altb, float altc, float altAngleAtZero, int altAcuteObtuse, float altLimitAngle, float azGearRatio, float azMotorDirection, float azb, float azc, float azAngleAtZero, int azAcuteObtuse, float azLimitAngle, float minAz, float minAlt, float maxAz, float maxAlt){ if (digitalRead(HeliostatToSun)==HIGH){sunTrackerOrHelio=1;} if ((iterationsAfterReset==0) || (FirstIterationAfterArduinoReset==0)){//Machine Resets Position if((digitalRead(WindProtectionSwitch
in „Heliostatensteuerung mit Arduino Uno“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
VFD_TEST.ino
#include <SoftwareSerial.h> int SS_TXPin = 5; int SW_SERIAL_UNUSED_PIN=0; SoftwareSerial Serial1t(SW_SERIAL_UNUSED_PIN, SS_TXPin); byte helper1[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13 }; byte helper2[] = { 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27 }; String centerString(String text); void setup() { delay(2000); Serial1t.begin(9600); Serial1t.write(0x1B); Serial1t.write(0x05); Serial1t.write(0x1B); Serial1t.write(0x0A); Serial1t.write(0x1B
in „Hat schon jemand was mit dem FUJITSU VF60 Display gemacht?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test.ino.asm
C:\Users\Arvid\AppData\Local\Temp\arduino_build_930562/test.ino.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn 0 .data 00000050 00800100 000005c2 00000656 2**0 CONTENTS, ALLOC, LOAD, DATA 1 .text 000005c2 00000000 00000000 00000094 2**1
in „Atmega328 1-Wire mit Timer CTC/PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
testController.ino
const int buttonStartPin = 2; const int buttonStopPin = 3; const int relaisPin = LED_BUILTIN; // LED, change to relais output pin enum states : int { stateIdle = 0, stateLedOn, stateLedOff }; // Global Vars int actualState = stateIdle; int oldState = -1; unsigned long waitTime = 0; unsigned long timeStart; unsigned long debounceTime; bool buttonStartPressed; bool buttonStopPressed; int buttonStartOld = 1; int buttonStopOld = 1; /* * start a non blocking delay */ void startDelay(unsigned long delayTime_ms) { timeStart = millis(); waitTime = delayTime_ms; } /* * stop running delay */ void abortDelay()
in „Ansteuerung eines Schrittmotors mit 2 Endschaltern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
WLAN_RELAY.ino
#include <ESP8266WiFi.h> #ifndef STASSID #define STASSID "xxxxxxxx" #define STAPSK "xxxxxxxx" #endif #undef DEBUG #ifdef DEBUG unsigned long PacketCount=0; #endif const char* ssid = STASSID; const char* password = STAPSK; // The server accepts connections on this port unsigned int TCPPort = 8080; WiFiServer tcpServer(8080); // Objects for connections #define MAX_TCP_CONNECTIONS 5 WiFiClient clients[MAX_TCP_CONNECTIONS]; // Buffer for incoming text char tcp_buffer[MAX_TCP_CONNECTIONS][30]; bool getCommand(Stream& source, char* buffer, int bufSize, char maxLength) { int data=source.read(); if (data>=0)
in „ESP8266 als TCP Server verschluckt Client Pakets“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
testController.ino
#include <Servo.h> /* * Pin Definitions */ const int buttonStartPin = 2; const int buttonStopPin = 3; const int limitHomePin = 4; const int limitEndPin = 5; const int relaisPin = LED_BUILTIN; // LED, change to relais output pin /* * global states for main state machine */ enum states : int { stateIdle = 0, stateStart, stateSpinUp, stateMoveEndPos, stateWaitEndPos, stateMoveHomePos, stateSpinDown }; /* * Global Variables */ Servo sawMotorESC; // saw motor, driven by ESC and PPM signal int actualState = stateIdle; // main state int oldState = -1; // previous state unsigned long waitTime = 0; // watit
in „Ansteuerung eines Schrittmotors mit 2 Endschaltern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
AD9833.ino
#include "Wire.h" #include "TimerOne.h" int FSYNC = 6; int SDATA = 7; int SCLK = 8; int LED = 3; int Taster = 2; int Start = 0; unsigned long erg; unsigned long freq=0; byte wave=1; char ser='w'; int alle_x_sekunden=1; int aktiv=1; void setup() { pinMode(LED, OUTPUT); pinMode(Taster, INPUT); pinMode(FSYNC, OUTPUT); pinMode(SDATA, OUTPUT); pinMode(SCLK, OUTPUT); digitalWrite(FSYNC, HIGH); digitalWrite(SDATA, LOW); digitalWrite(SCLK, HIGH); Wire.begin(); Serial.begin(38400); UpdateRegister(0x2100); // Nach Application Note AN-1070 von Analog Devices UpdateRegister(0x50C7); UpdateRegister(0x4000)
in „Sweep Generator mit AD5930“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
TwoDevices.ino
/* Devil-Elec Arduino IDE 1.8.12 avr-gcc 9.3.0 Arduino Mega2560 28.04.2020 License: GNU GPLv3 CombiePin Library hat User combie zur Verfügung gestellt */ #include <util/atomic.h> #include "AvrRegister.h" #include "DevilSpi.h" #include <CombiePin.h> using namespace Combie::Pin; // notwendige SPI Konfiguration OutputPin<53> SSpin; // beim UNO Pin 10 OutputPin<52> CLKpin; // beim UNO Pin 13 OutputPin<51> MOSIpin; // beim UNO Pin 11 OutputPin<5> messPin5; OutputPin<6> messPin6; OutputPin<7> messPin7; SpiSlave <11, 32> device1; // slave select pin, SPI clock divider SpiSlave <12, 8> device2; ring *ptrISRbuffer
in „Syntaxfrage Funktionsdefinition mit Optionen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
TEST3.ino
#include "Arduino.h" #include <RFM69.h> #include <SPI.h> #include <SPIFlash.h> #define MYNODEID 1 //#define LED 0 #define TONODEID 2 #define FREQUENCY RF69_433MHZ #define NETWORKID 0 #define ENCRYPT false // Set to "true" to use encryption #define ENCRYPTKEY "TOPSECRETPASSWRD" // Use the same 16-byte key on all nodes // Use ACKnowledge when sending messages (or not): #define USEACK false // Request ACKs or not RFM69 radio; static char sendbuffer[62]; static int sendlength = 11; void setup() { Serial.begin(9600); delay(8000); Serial.print(F("Node ")); Serial.print(MYNODEID,DEC); Serial.println(F
in „RFM69HW - Arduino Uno“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
SimpleMorse.ino
void setup() { Serial.begin(115200); Serial.print("Bitte Morsetext eingeben\r\n"); pinMode(13, OUTPUT); } int PinOut = 13; String incomingString = ""; //Array Di=1 Dah=3, 2=Leer 5 Elemente pro Buchstabe uint8_t Morsecode[211] = {1, 3, 2, 2, 2, 3, 1, 1, 1, 2, 3, 1, 3, 1, 2, 3, 1, 1, 2, 2, 1, 2, 2, 2, 2, 1, 1, 1, 2, 2, 3, 3, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, 2, 2, 2, 1, 3, 3, 3, 2, 3, 1, 3, 2, 2, 1, 3, 1, 1, 2, 3, 3, 2, 2, 2, 3, 1, 2, 2, 2, 3, 3, 3, 2, 2, 1, 3, 3, 1, 2, 3, 3, 1, 3, 2, 1, 3, 1, 2, 2, 1, 1, 1, 2, 2, 3, 2, 2, 2, 2, 1, 1, 3, 2, 2, 1, 1, 1, 3, 2, 1, 3, 3, 2, 2, 3, 1, 1, 3, 2, 3, 1, 3, 3,
in „"Hilfe beim Programmieren" !“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Bluetooth_Geruest.ino
#include <SoftwareSerial.h> #include <Crc16.h> #include <EEPROM.h> Crc16 crc; SoftwareSerial BTSerial(8, 7); void load_config(); void save_config(); uint16_t calc_crc(unsigned char *msg, int n, uint16_t init); uint8_t configs[18] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t configsbuf[18] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; unsigned short crcrx = 0; boolean shot = true; String inputString = ""; //Serial Buffer boolean stringComplete = false; //Serial Helper boolean block = false; boolean receiveconfig = 0; String worker = ""; unsigned long previousMillis
in „Kleines Android-Arduino-Stepper Projekt“ · Softwareentwicklung ·
-
Datei
SipDial.ino
/* ==================================================================== * * Copyright (c) 2018 Juerge Liegner All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided
-
Datei
v19.ino
int l = 2; int th = 5; int tl = 6; int ch = 0; void setup() { pinMode (l, OUTPUT ); //LED pinMode (th, INPUT); // Touch 1 pin in und out festlegung pinMode (tl, INPUT); // Touch 2 digitalWrite (l, LOW); // LED Signal Deffinieren delay (500); } void loop() { if (digitalRead (th) == HIGH); { digitalWrite (l, +50); delay (500); if (l > 255); { digitalWrite (l, 0); } } delay (500); if (digitalRead (tl) ==HIGH); { digitalWrite (l, -50); if (l < 0); { digitalWrite (l, 255); } } delay (500); if (digitalRead (th=tl) == HIGH); { digitalWrite (l, 0); } delay (500); }
in „Arduino Tocuhsensor LED "Dimmen"“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
KnightRider.ino
/* a LED driver, knight rider style drives a string of intelligent LEDs (WS2812B) speed setting via voltage on analog input */ #include <Adafruit_NeoPixel.h> #define LED_CNT 30 #define LED_PIN 22 #define POTI_PIN A0 Adafruit_NeoPixel pixels(LED_CNT, LED_PIN, NEO_GRB + NEO_KHZ800); #define COLOR 0xFF9600 // RGB, dark yellow //#define COLOR 0x0000FF // RGB, dark blue #define DECAY 1 // decay speed / cycle // non linear pwm table to account for non linear eye response const uint8_t pwmtable[32] PROGMEM = { 0, 1, 2, 2, 2, 3, 3, 4, 5, 6, 7, 8, 10, 11, 13, 16, 19, 23, 27, 32, 38, 45, 54, 64, 76, 91, 108
in „LED-Lauflicht im Knight Rider Style“ · Projekte & Code ·
-
Datei
DisplayTest.ino
/* Arduino 2x16 LCD - Without Buttons modified on 18 July 2020 */ #include <LiquidCrystal.h> //LCD pin to Arduino const int pin_RS = 8; const int pin_EN = 9; const int pin_d4 = 4; const int pin_d5 = 5; const int pin_d6 = 6; const int pin_d7 = 7; const int pin_BL = 10; LiquidCrystal lcd( pin_RS, pin_EN, pin_d4, pin_d5, pin_d6, pin_d7); //User definierte Zeichen // Bathi sign byte bathi[8] = { B01110, B11011, B10001, B11111, B11111, B11111, B11111, B11111 }; // Batlo sign byte batlo[8] = { B01110, B11011, B10001, B10001, B10001, B10001, B11111, B11111 }; // Ohm sign byte ohm[8] = { B00000, B01110,
-
Datei
ClassDelete.ino
/* Experiment for creating c++ objects dynamically and deleting them What: How can c++ memory leaks be avoided whe using dynamic objects? why: Memory leaks have to be avoided for long time operation. I memory need over time increases, the system will crash. how: create and delete objects by commands from the serial line ( see help command in the code ) Original example with static functions "Blink without delay" from adafruit https://learn.adafruit.com/multi-tasking-the-arduino-part-1/a-classy-solution extended with for memory test by 2025-02-24 mchris */ uint8_t Idx = 0; class Flasher { // Class
in „cpp memory leaks vermeiden“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Timer_ISR.ino
#include <util/atomic.h> volatile uint16_t cnt16; volatile bool flag_500ms; // Timer ISR, must be adapted for Non-AVR Arduinos ISR( TIMER1_COMPA_vect ) { static uint8_t cnt; cnt++; cnt16++; if (cnt == 50) { cnt = 0; flag_500ms = true; } } int init_timer(int prescaler, uint16_t f_timer) { uint32_t tmp; uint8_t pre = 0; tmp = (F_CPU / ((uint32_t)prescaler * f_timer))-1; if (tmp > 65535) return 1; TCCR1A = 0; switch (prescaler) { case 1: pre = 1; break; case 8: pre = 2; break; case 64: pre = 3; break; case 256: pre = 4; break; case 1024: pre = 5; break; default: return 1; break; } TCCR1B = (1<<WGM12
in „Arduino: digitalRead in Interrupt ist unzuverlässig“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
fun1.ino
// debounce GPIO input void getPin(gpio_num_t pin, bool* state, const unsigned long dur) { unsigned long cur = millis() / 1000; static unsigned long lastRead = 0; static unsigned long lastHigh = 0; static unsigned long lastLow = 0; static bool high = false; static bool low = false; if (cur == lastRead) { return; } else { lastRead = cur; } if (digitalRead(pin) == HIGH) { if (!high) { lastHigh = cur; high = true; } if ((cur - lastHigh) > dur) { *state = true; low = false; } } else { if (!low) { lastLow = cur; low = true; } if ((cur - lastLow) > dur) { *state = false; high = false; } } } // usage void
in „Tasterentprellen für Dummies“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
fun2.ino
int get_keyevent(bool* key) { struct KeyState { bool* ptr; unsigned long pressStart; bool active; bool reportedShort; bool reportedLong; }; static KeyState states[10]; static int count = 0; const unsigned long tMin = 50; // ms const unsigned long tGap = 1000; // ms unsigned long now = millis(); // Lookup or register int index = -1; for (int i = 0; i < count; ++i) { if (states[i].ptr == key) { index = i; break; } } if (index == -1 && count < 10) { states[count] = { key, 0, false, false, false }; index = count++; } if (index == -1) return 0; KeyState& s = states[index]; // Rising edge: start tracking
in „Tasterentprellen für Dummies“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Scannner_Veit.ino
#include <Wire.h> void setup() { Wire.begin(); Serial.begin(9600); Serial.println("\nI2C Scanner"); } void loop() { byte error {255}; byte address {0}; int nDevices {0}; Serial.println("Scanning..."); for(address = 1; address < 78; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0) { Serial.print("I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.print(address,HEX); Serial.println(); nDevices++; } else if (error==4) {
in „Arduino: page-write in I2C eeprom verliert sporadisch ein Byte“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
defineMAXBUFFER.ino
#define MAXBUFFER 20 // für längstes Kommando auf Serial In // --------------- serial in --------------- if (Serial.available() > 0) { char incomingByte = (char)Serial.read(); if(incomingByte == 13) { // Wenn das Enter ankommt strcpy(serial_in_command, serial_in_buff); memset(&serial_in_buff[0], 0, sizeof(serial_in_buff)); // 30.554 Bytes chr_cnt = 0; } // if(incomingByte == 13) else { // Falls kein Enter kommt muss der Text gespeichert werden in dem inText Array if(isprint(incomingByte)) { if(chr_cnt<(MAXBUFFER-2)) serial_in_buff[chr_cnt++] = incomingByte; else { Serial.println(F("serBUF ov->
in „Arduino: page-write in I2C eeprom verliert sporadisch ein Byte“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
fermenting-control.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! */ // Values visible in THIS file only! // namespace SelfValues { // static constexpr char FILE_AND_VERSION[] = "00.0025"; // } #ifndef DUMMY // Macro statements ============================================= #ifndef DUMMY // 3rd party includes ------------------------------------------- // 3rd party files #include <Arduino.h> #include <Streaming.h> // For convenient printouts to Serial
in „Flexible SplitText() Klasse (Anfänger)“ · Projekte & Code ·
-
Datei
PunkteAnzeige.ino
#include "uMuxOutputLib.h" #include "debounce.h" constexpr size_t Id1up=3; constexpr size_t Id1dn=0; constexpr size_t Id2up=2; constexpr size_t Id2dn=1; constexpr size_t incount=4; constexpr bool AN=true; constexpr bool AUS=false; constexpr bool ACTIVE_MUX=true; int pins[8] = {6, 7, 8, 9, 10, 11, 12, 13}; int muxes[4] = {3, 2, 4, 5}; const int inpins[incount] = {A0, A1, A2, A3}; const bool cg[11][7] = { /* 0 */ { /* a */ AN, /* b */ AN, /* c */ AN, /* d */ AN, /* e */ AN, /* f */ AN, /* g */ AUS }, /* 1 */ { /* a */ AUS, /* b */ AN, /* c */ AN, /* d */ AUS, /* e */ AUS, /* f */ AUS, /* g */ AUS
in „7-Segment LEDs ansteuern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test_Vector.ino
#include <Arduino.h> #include <Vector.h> 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
in „Anfänger-Entwicklung einer Gärbox Steuerung“ · Offtopic ·
-
Datei
Car1.ino
const int pwmPin = PB1; // Der Pin, der per PWM gesteuert wird const int duration = 3000; // Dauer für das Hoch- und Runterfahren in Millisekunden const int steps = 255; // Anzahl der Schritte für die PWM (0-255 für 8-Bit PWM) void setup() { pinMode(pwmPin, OUTPUT); // Setzt den Pin als Ausgang } void loop() { // Hochfahren des Pins for (int value = 0; value <= steps; value++) { analogWrite(pwmPin, value); // PWM-Wert auf den Pin schreiben delay(duration / (2 * steps)); // Berechnet die Verzögerung für 3 Sekunden Gesamtzeit } // Runterfahren des Pins for (int value = steps; value >= 0; value--)
in „(AVR) Attiny85 PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
IR-test.ino
// Pin für die IR-LED definieren const int irLedPin = 3; // Pin 3 unterstützt PWM-Ausgabe (wichtig für Timer) const int irSensorPin = 7; // Pin für den IR-Sensor (TSOP4838) void setup() { pinMode(irLedPin, OUTPUT); // Setze den Pin für die IR-LED als Ausgang pinMode(irSensorPin, INPUT); // Setze den Pin für den IR-Sensor als Eingang Serial.begin(9600); // Initialisiere die serielle Kommunikation enableIRModulation(); // Starte die 38-kHz-Modulation } void loop() { // Schalte die LED für 1 Sekunde ein digitalWrite(irLedPin, HIGH); delay(1000); // Überprüfen, ob der IR-Sensor das modulierte Signal
in „TSOP4838 und IR-Led“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
IR-test.ino
// Pin für die IR-LED definieren const int irSensorPin = 7; // Pin für den IR-Sensor (TSOP4838) void setup() { Serial.begin(9600); // Serielle Kommunikation initialisieren pinMode(irSensorPin, INPUT); // Setze den Pin für den IR-Sensor als Eingang enableIRModulation(); // Starte die 38-kHz-Modulation } void loop() { // Überprüfen, ob der IR-Sensor das modulierte Signal empfängt if (digitalRead(irSensorPin) == LOW) { // Der TSOP4838 gibt LOW aus, wenn er ein gültiges Signal empfängt Serial.println("IR-Signal empfangen!"); } else { Serial.println("Kein IR-Signal."); } delay(500); // Warte 500 ms,
in „TSOP4838 und IR-Led“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
IR-test.ino
#include <IRremote.h> const int irLedPin = 3; // Pin für die IR-LED const int irSensorPin = 7; // Pin für den IR-Sensor (TSOP4838) IRsend irsend(irLedPin); // Erstelle ein IRsend-Objekt void setup() { Serial.begin(9600); // Serielle Kommunikation initialisieren pinMode(irSensorPin, INPUT); // Setze den Pin für den IR-Sensor als Eingang } void loop() { // Sende ein 38 kHz IR-Signal irsend.sendNEC(0xFF00FF, 32); // Beispiel: Sende NEC IR-Signal (ersetzbar durch dein Signal) // Überprüfen, ob der IR-Sensor das modulierte Signal empfängt if (digitalRead(irSensorPin) == LOW) { // Der TSOP4838 gibt
in „TSOP4838 und IR-Led“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Arduino_Diffusion.ino
/******************************************************** ** Download from: ** ** http://www.alhin.de/arduino/index.php?n=44 ** ********************************************************/ #include <AH_EasyDriver.h> //AH_EasyDriver(int RES, int DIR, int STEP); // RES -> RESOLUTION per full revolve // DIR -> DIRECTION PIN // STEP -> STEPPING PIN AH_EasyDriver stepper(200,9,8); // Initialisation // DIR-Pin = Pin 9 // STEP-Pin = Pin 8 const int buttonPin = 2; // the number of the pushbutton pin int sensorPin = A0; // Analoger Input für die Spannung der Photodiode - analog input for the photodiode-voltage
in „Physikprojekte“ · Offtopic ·
-
Datei
sender_esp.ino
#include <ESP8266WiFi.h> #include <espnow.h> // REPLACE WITH RECEIVER MAC Address uint8_t broadcastAddress[] = {0x58, 0xBF, 0x25, 0xD6, 0xF6, 0x8C}; #define REF_PIN 5 // Structure example to send data // Must match the receiver structure uint8_t data = 2; unsigned long lastTime = 0; unsigned long timerDelay = 300; // send readings timer // Callback when data is sent void OnDataSent(uint8_t *mac_addr, uint8_t sendStatus) { Serial.print("Last Packet Send Status: "); if (sendStatus == 0){ Serial.println("Delivery success"); } else{ Serial.println("Delivery fail"); } } void setup() { pinMode(REF_PIN, OUTPUT
in „ESP-NOW timing accuracy auf ESP8266/ESP32“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
receiver_esp.ino
#include <ESP8266WiFi.h> #include <espnow.h> #define REF_PIN 5 // Structure example to receive data // Must match the sender structure uint8_t data; // Callback function that will be executed when data is received void OnDataRecv(uint8_t * mac, uint8_t *incomingData, uint8_t len) { data = incomingData[0]; digitalWrite(REF_PIN, !digitalRead(REF_PIN)); Serial.print("Bytes received: "); Serial.println(data); } void setup() { pinMode(REF_PIN, OUTPUT); // Initialize Serial Monitor Serial.begin(115200); // Set device as a Wi-Fi Station WiFi.mode(WIFI_STA); // Init ESP-NOW if (esp_now_init() != 0) { Serial.println
in „ESP-NOW timing accuracy auf ESP8266/ESP32“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Arduino_Fernbedienung.ino
// Written by: Mohamed Soliman // This code is for controlling servo motor with IR remote control // When clicking at any of two buttons the motor is toggling between the rotation and stop #include <IRremote.h> //must copy IRremote library to arduino libraries #include <Servo.h> #define plus 0xA3C8EDDB //clockwise rotation button #define minus 0xF076C13B //counter clockwise rotation button int RECV_PIN = 2; //IR receiver pin Servo servo; int val; //rotation angle bool cwRotation, ccwRotation; //the states of rotation IRrecv irrecv(RECV_PIN); decode_results results; // ================ // === SETUP
in „Physikprojekte“ · Offtopic ·
-
Datei
test_sketch.ino
#include <Adafruit_NeoPixel.h> #define PIN 10 Adafruit_NeoPixel strip = Adafruit_NeoPixel(32, PIN, NEO_GRB + NEO_KHZ800); void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' strip.setBrightness(50); } void loop() { // Some example procedures showing how to display to the pixels: colorWipe(strip.Color(255, 0, 0), 50); // Red colorWipe(strip.Color(0, 255, 0), 50); // Green colorWipe(strip.Color(0, 0, 255), 50); // Blue //colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW // Send a theater pixel chase in... theaterChase(strip.Color(127, 127, 127), 50); // White theaterChase
in „Problem mit WS2812b 4-Layer Board“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
CaptivePortal.ino
/* Basisprogramm für ein Captive Portal * Grundversion, die bei einer Verbindung auf dem Client den Browser öffnet * und eine Startseite darstellt. * Der HTML-Code ist rudimentär, um das Beispiel einfach zu halten * Der Webserver antwortet auf die url / mit der Captive-Seite, bei index.html * wird eine andere Webseite ausgegeben, die über eine Funktion generiert wird. * Version 1.0 * Getestet mit Android-Handy und Android-Tablet => ok * Gestestet mit Windows-PC => Browser versucht auf eine Microsoft-Adresse umzuleiten */ #define __Version__ "V1.0 CaptivePortal" #include <Arduino.h> #include <WiFi.h
in „Mikrocontroller Einstieg“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
CaptivePortal.ino
/* Basisprogramm für ein Captive Portal * Grundversion, die bei einer Verbindung auf dem Client den Browser öffnet * und eine Startseite darstellt. * Der HTML-Code ist rudimentär, um das Beispiel einfach zu halten * Der Webserver antwortet auf die url / mit der Captive-Seite, bei index.html * wird eine andere Webseite ausgegeben, die über eine Funktion generiert wird. * Version 1.0 * Getestet mit Android-Handy und Android-Tablet => ok * Gestestet mit Windows-PC => Browser versucht auf eine Microsoft-Adresse umzuleiten */ #define __Version__ "V1.0 CaptivePortal" #include <Arduino.h> #include <WiFi.h
in „Mikrocontroller Einstieg“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
EADOGM_Test.ino
#define PinD7 7 #define PinD6 6 #define PinD5 5 #define PinD4 4 #define PinE 3 // Enable #define PinRW 2 // Read/Write #define PinRS 10 // Command/Data #define OpClear 0b00000001 #define OpHome 0b00000010 #define OpDispOn 0b00001100 #define OpDispOff 0b00001000 #define OpCursorOn 0b00001111 #define OpCursorOff 0b00001100 int val = 0; byte nibble = (0x00 & 0xF0) >> 4; byte xPos = 7; byte yPos = 1; void portClear() { digitalWrite(PinD7, LOW); digitalWrite(PinD6, LOW); digitalWrite(PinD5, LOW); digitalWrite(PinD4, LOW); } void portSet() { digitalWrite(PinD7, HIGH); digitalWrite(PinD6, HIGH); digitalWrite
in „EADOGM162W-A-Anzeige mit XMEGA“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sender_1.ino
// http://www.meinduino.de/arduino-howto/2014/09/18/serielleuebertragung1.html // Damit die Pins schnell geschaltet werden können #include <digitalWriteFast.h> // Hier ist der Verstärker mit der IR-LED angeschlossen #define IRLED 8 #define LEDpin 9 // Globale Variablen für den Timer-Interrupt volatile uint8_t pinZustand = HIGH; volatile uint8_t sendenAn = false; /************************************************************* * * void setup() * * Wird einmal beim Programmstart ausgeführt * *************************************************************/ void setup() { pinMode(8, OUTPUT); // IRLED ist
in „neutralisierung der phaseninvertierung“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
DeskControl.ino
// DEFINES ////////////////////////// // From motor controller to Arduino #define PIN_SIGNAL_IN 3 // Must be interrupt pin, depends on board! (YELLOW) #define PIN_UP_SWITCH_OUT 4 // (GREEN) #define PIN_DOWN_SWITCH_OUT 5 // (BLUE) // From hand switch to Arduino #define PIN_SIGNAL_OUT 7 // (YELLOW) #define PIN_UP_SWITCH_IN 8 // (GREEN) #define PIN_DOWN_SWITCH_IN 9 // (BLUE) // Interrupts #define INTERRUPT_SIGNAL_IN 0 // Must match pin PIN_SIGNAL_IN above! // Directions #define DIR_NONE 0 #define DIR_UP 1 #define DIR_DOWN 2 // Constants #define MAX_ULONG 4294967295 // Maximum value an unsigned long can
in „Steuerung für höhenverstellbaren Schreibtisch“ · Projekte & Code ·
-
Datei
bcd_caliper.ino
/* Reading data from digital calipers with 6 digit BCD protocol Data format as it appears on the serial line. The first nibble holds 1/100mmm, the next 1/10mm, then 1mm and so on. If the unit is inches, it starts with 1/1000 inch. Nibble_1 Nibble_2 Nibble_3 Nibble_4 Nibble_5 Nibble_6 Nibble_7 -------- -------- -------- -------- -------- -------- -------- xxxx.xN xxxx.Nx xxxN.xx xxxNx.xx xNxx.xx Nxxx.xx bitvalues # mm xxx.xxN xxx.xNx xxx.Nxx xxxN.xxx xNx.xxx Nxx.xxx bitvalues # inches Nibble 1-6 : BCD (binary coded decimal) Timing: 1 bit ca. 12 µsec 1 nibble with sync ca. 100 µsec example 1, first
in „Messschieber (BCD Protokoll) mit Arduino auslesen“ · Projekte & Code ·
-
Datei
Lan_Server.ino
/* Created by Rui Santos Visit: http://randomnerdtutorials.com for more arduino projects Arduino with Ethernet Shield */ #include <SPI.h> #include <Ethernet.h> int Code = 0; int timeoff = 0; int timer = 0; int opening = 0; int pos = 0; byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address byte ip[] = { 192, 168, 178, 178 }; // ip in lan (that's what you need to use in your browser. ("192.168.1.178") byte gateway[] = { 192, 168, 178, 1 }; // internet access via router byte subnet[] = { 255, 255, 255, 0 }; //subnet mask EthernetServer server(80); //server port String readString
in „Arduino WEB Safe“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Maiskolben_TFT.ino
#include <TFT.h> #include <SPI.h> #include <TFT_ILI9163C.h> #include <PID_v1.h> #include <EEPROM.h> #include "TimerOne.h" #include "definitions.h" /* * If your display stays white, uncomment this. * Cut reset trace (on THT on upper layer/0R), connect STBY_NO (A1) with reset of TFT (at 4050). * See also readme in mechanical folder for reference. */ //#define USE_TFT_RESET /* * If red is blue and blue is red change this * If not sure, leave commented, you will be shown a setup screen */ //#define HARDWARE_DEFINED_TFT 2 /* * Based on your Hardware-Revision there may be modifications to the PCB. * In
in „Probleme bei kompilieren des Maiskolben-Sketch's“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
testESP.ino
#include "Arduino.h" extern "C" { #include "fs/ff.h" } #include <ESP8266WiFi.h> const char* ssid = "SSID_OF_YOUR_NETWORK_HERE"; const char* password = "WIFI_PASSWORD_GOES_HERE"; // Create an instance of the server on Port 80 WiFiServer server(80); unsigned long ulReqcount; unsigned long ulReconncount; void WiFiStart(); //The setup function is called once at startup of the sketch void setup() { uint8_t work[512]; f_mkfs("", FM_SFD, 0, work, 512); // inital connect WiFi.mode(WIFI_STA); WiFiStart(); // Add your initialization code here } // The loop function is called in an endless loop void loop(
in „Arduino Sloeber - C Code einbinden“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
les_test.ino
#include <stdio.h> #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> #define LED 2 #define REDPIN 6 #define GREENPIN 5 #define BLUEPIN 2 int RVal = 0; int GVal = 0; int BVal = 0; char valInfo[16]; const char *ssid = "LEDStrip"; const int Port = 5555; const String ID = "TV"; String wifipassword, wifissid; IPAddress ip; ESP8266WebServer webserver(80); bool webserverStopped = false; /* Just a little test message. Go to http://192.168.4.1 in a web browser * connected to this access point to see it. */ void handleRoot() { if( webserver.args() > 0 ){ wifipassword = webserver.arg
in „ESP8266 12e Reset beim nach dem Starten“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Timer_Polling.ino
void setup() { // put your setup code here, to run once: Serial.begin(9600); TIMSK1 = 0; // timer overflow interrupts ausschalten TCNT1 = 0; // timer register initialisierne TCCR1A = 0; TCCR1B = 5; // normaler modus mit Prescaler 1024 TIFR1 |= 0x01; // TOV-bit auf 1, somit nicht gesetzt? } void loop() { if (TIFR1 & 0x01) { // nock kein Timer Ueberlauf Serial.println(TIFR1, BIN); } else { Serial.println("***"); TIFR1 |= 0x01; }; Serial.flush(); // eine halbe Sekunde warten unsigned long timenow = millis(); while (millis() - timenow < 500); }
in „Arduino (Atmega328P) Timer overflow mit polling“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PID-Regler.ino
float PIDRegler(float T1,float T2) // PID-Regler { // Diese Werte müssen gespeichert werden static float En=0.0,en1=0.0,en2=0.0; static float Yn=0.0,yn1=0.0; static int Yna; // Empfindlichkeit des PID-Reglers float Tn = 1.0; // wär auch sinnvoll wenn man diesen Wert an der Funktion übergibt float Tv = 1.0; // wär auch sinnvoll wenn man diesen Wert an der Funktion übergibt float Kp = 1.0; // wär auch sinnvoll wenn man diesen Wert an der Funktion übergibt // Variablen für P,I,D float P,I,D; // Zeitkostente float delta_t=0.1; float delta_y; En = T1 - T2; // "Regelgröße" Temperatur_2 wird an Temperatur
in „PID Regler Parameter rechnerisch bestimmen?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sd_test.ino
/* SD card test Hardware: Nano This example shows how use the utility libraries on which the' SD library is based in order to get info about your SD card. Very useful for testing a card when you're not sure whether its working or not. ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - pin 2 created 28 Mar 2011 by Limor Fried modified 9 Apr 2012 by Tom Igoe */ // include the SD library: #include <SPI.h> #include <SD.h> String Version = "V 2018-02-10"; // set up variables using the SD utility library functions: Sd2Card card; SdVolume volume; SdFile root; const int chipSelect = 2; // 31.12.2015
in „Arduino: SD-Library - Karte entfernen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Marko_Snarm.ino
#include <Servo.h> Servo Servo[4]; int iniVal[4] = { 90, 35, 60, 90}; int val[4] = { iniVal[0], iniVal[1], iniVal[2], iniVal[3]}; int buttonPin = 4; // Knopf zum Tee machen // 10 35 60 65 unsigned char min[4] = { 10, 35, 60, 65}; // begrenze den unteren Verfahrweg damit nichts anschlägt unsigned char max[4] = {170, 120, 155, 90}; // begrenze den oberen Verfahrweg // 170 120 155 90 void setup() { unsigned char i; Servo[0].attach(11); Servo[1].attach(10); Servo[2].attach(9); Servo[3].attach(6); pinMode(buttonPin, INPUT_PULLUP); // pullUp am Knopf aktivieren pinMode(5, OUTPUT); // Teelichtanzeige
in „Terminal-Programm mit zeitgesteuerte Zeilenausgabe“ · PC Hard- und Software ·
-
Datei
led-blinken.ino
#define AUSWAHL_CNT 36 #define SEQUENZ_CNT 9 unsigned long millis_auswahl; unsigned long milis_blinken; unsigned interval = 2000; int auswahl; int anzeige; int sequenz; int blinken; uint8_t led_direkt[AUSWAHL_CNT][3] = // LED for Direktauswahl { {0,0,0}, {0,0,3}, {0,0,4}, {0,0,5}, {0,3,5}, {0,3,4}, {3,4,5}, {0,0,6}, {0,0,7}, {0,0,8}, {0,6,8}, {0,6,7}, {6,7,8}, {0,0,9}, {0,0,10}, {0,0,11}, {0,9,11}, {0,9,10}, {9,10,11}, {0,0,12}, {0,0,13}, {0,0,14}, {0,12,14}, {0,12,13}, {12,13,14}, {0,0,15}, {0,0,16}, {0,0,17}, {0,15,17}, {0,15,16}, {4,5,6}, {0,0,3}, {0,0,19}, {0,0,20}, {0,18,20}, {0,18,19}, {
in „Arduino - Problem mit einer Dauerschleife“ · Mikrocontroller und Digitale Elektronik ·