-
Datei
Treppenlicht.ino
#include <Adafruit_NeoPixel.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 = 120000; // Sperrzeit bevor die Scheife beendet wird und die anderen Laufen kann #define NUMPIXELS 394 // Anzahl der Nanopixel-LEDs Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, Nanopixel, NEO_GRB + NEO_KHZ800
in „Dynamischer Variablenname in Scheife hochzählen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Treppenlicht.ino
#include <Adafruit_NeoPixel.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 = 120000; // Sperrzeit bevor die Scheife beendet wird und die anderen Laufen kann #define NUMPIXELS 394 // Anzahl der Nanopixel-LEDs Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, Nanopixel, NEO_GRB + NEO_KHZ800
in „Dynamischer Variablenname in Scheife hochzählen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Auslesen.ino
// add this to the top of your sketch #define NOP __asm__ __volatile__ ("nop\n\t") #include <SPI.h> const byte MAX1_CS = 24; // CS pin 24 const byte MAX2_CS = 25; const byte MAX3_CS = 26; // SO pin 50 Mega 2560 // CLK pin 52 Mega 2560 void setup() { Serial.begin(9600); //SPI.setBitOrder(MSBFIRST); //SPI.setClockDivider(SPI_CLOCK_DIV8); // wären 2 MHz SPI Takt //SPI.setDataMode(SPI_MODE0); // DataMode 0 SPI.begin(); pinMode(53, OUTPUT); // wegen SPI Funktion notwendig digitalWrite(MAX1_CS, HIGH); // CS High Pegel // digitalWrite(MAX2_CS, HIGH); // digitalWrite(MAX3_CS, HIGH); pinMode(MAX1_CS, OUTPUT
in „S-Function für mehrere Temperaturfühler“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
nand.ino
// Original Code Copyright 2017 James Tate <thejamestate@gmail.com> // Modified Code Copyright 2017 Michael Niewöhner <foss@mniewoehner.de> // // Flash Chip Reader // 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
in „NAND Flash dumpen mit Teensy 2.0++“ · Mikrocontroller und Digitale Elektronik ·
-
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
Angepasst.ino
#include <Wire.h> #include <PT2322.h> #include <LiquidCrystal.h> //verstäken ok bschwächen nicht. #define FUNCTIONPIN 47 #define UPPIN 48 #define DOWNPIN 49 #define MUTEPIN 31 #define DISPLAYMODE 0 #define EDITINGMODE 1 PT2322 audio; // initialize the library with the numbers of the interface pins const int rs = 4, en = 5, d4 = 6, d5 = 7, d6 = 8, d7 = 9; LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // enumerate PT2322 functions enum function {FMasterVolume, FFrontLeftVolume, FFrontRightVolume, FCenterVolume, FRearLeftVolume, FRearRightVolume, FSubVolume, FBass, FMiddle, FTreble, F3D, FToneDefeat, FEnd
in „PT2322 + mega2560 steuerung gestaltet sich schwer wie gedacht.“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
tcptest.ino
#include <ESP8266WiFi.h> #include <WiFiClient.h> const char* ssid = "WLAN"; const char* password = "PASSWORT"; const int serverport = 4210; WiFiServer server(serverport); void setup() { Serial.begin(115200); Serial.println(); Serial.printf("Connecting to %s ", ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(100); Serial.print("."); } Serial.println(); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); server.begin(); Serial.printf("Server started at port %d\n", serverport); } void loop() { WiFiClient client = server.available
in „ESP8266 TCP Server: Erster Verbindungsaufbau nach Reset dauert lange“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
reed.ino
const int impECU = A1; // impECU den Pin A1 zuweisen const int ledBLUE = 4; // ledBLUE den Pin 4 zuweisen const int REED = 2; // REED den Pin 2 zuweisen const int RELAY = 8; // RELAY den Pin 8 zuweisen const int battery = A0; // battery den Pin A0 zuweisen const int ledRED = 13; // ledRED den Pin 13 zuweisen const int ledGREEN = 7; // ledGREEN den Pin 7 zuweisen bool interruptFlag = False; /** REED ------------------------------- */ enum ReedState { REED_INACTIVE, REED_ACTIVE, REED_WAITING }; #define RELAY_ACTIVE_TIME 70 // ms void ReedStateMachine(bool reed) { static enum ReedState state = REED_INACTIVE
in „Arduino Interrupt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
reed.ino
const int impECU = A1; // impECU den Pin A1 zuweisen const int ledBLUE = 4; // ledBLUE den Pin 4 zuweisen const int REED = 2; // REED den Pin 2 zuweisen const int RELAY = 8; // RELAY den Pin 8 zuweisen const int battery = A0; // battery den Pin A0 zuweisen const int ledRED = 13; // ledRED den Pin 13 zuweisen const int ledGREEN = 7; // ledGREEN den Pin 7 zuweisen bool interruptFlag = False; /** REED ------------------------------- */ enum ReedState { REED_INACTIVE, REED_ACTIVE, REED_WAITING }; #define RELAY_ACTIVE_TIME 70 // ms void ReedStateMachine(bool reed) { static enum ReedState state = REED_INACTIVE
in „Arduino Interrupt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Akkustand.ino
#include <CapacitiveSensor.h> int rot = 9; int gruen = 10; int blau = 11; int zeit = 30; int a = 100; int pin1 = 13; int pin2 = 8; int pin3 = 7; int pin4 = 6; int pin5 = 4; int taster = 2; int count = 4000; int pop = 130; int mount = 5 ; int b = 1; int tasterstatus=0; CapacitiveSensor cs_3_5 = CapacitiveSensor(3,5); void setup() { cs_3_5.set_CS_AutocaL_Millis(0xFFFFFFFF); pinMode(rot, OUTPUT); pinMode(gruen, OUTPUT); pinMode(blau, OUTPUT); pinMode(pin1, OUTPUT); pinMode(pin2, OUTPUT); pinMode(pin3, OUTPUT); pinMode(pin4, OUTPUT); pinMode(pin5, OUTPUT); pinMode(taster, INPUT); Serial.begin(9600); } //setColor
in „Richtiger Mikroprozessor“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
code.ino
/* Adafruit_PCD8544 display = Adafruit_PCD8544( 2, 3, 4, 5, 6); // Rotary Encoder int pinA = 8; int pinB = 7; int SW = A1; // Pot Input int cPotPin = A4; // contrast set-pot int hafPotPin = A5; // hot air fan // Buzzer int buzzerPin = 9; // Tool Pins // Outputs int haHePin = 10; // hot air heating element int hafPin = 11; // hot air fan int siHePin = 12; // iron // State Switches Inputs int haRsPin = 13; // hot air handle reed switch int siSsPin = A3; // soldering iron sleep-switch // Thermocouple Inputs int haThPin = A0; // Hot Air Handle int siThPin = A2; // Soldering Iron */ /////////////////////
in „Verzweifelt wegen Drehencoder und Interrupt :/“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
nexus.ino
#include <splash.h> #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SH110X.h> #include <MuxClient.h> #include <Button.h> #include <Fan.h> /* Mux Adresslist: 0 Ext2 1 Ext1 2 Button 3 Sense 0 4 Sense 1 5 Sense 2 6 Sense 3 7 Pot 8 Var 9 TMP OR 10 TMP UR 11 TMP Mitte 12 TMP UL 13 TMP OL 14 Mot2 Sense 15 Mot1 Sense */ #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels #define OLED_MOSI 9 #define OLED_CLK 10 #define OLED_DC 11 #define OLED_CS 12 #define OLED_RESET 13 #define MUX_S0 14 // A0 #define MUX_S1
in „Laufzeitproblem mit Mux und Arduino Nano 33 ioT“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
lauflicht.ino
#include <Arduino.h> const int LED_Pins[5] = {8,9,10,11,12}; const int Button_Pin = 7; unsigned long Start_Millis = 0; unsigned long Current_Millis = 0; unsigned long Blinkwartezeit = 1000; uint8_t start = 0; uint8_t step = 0; uint8_t step_max = 5; void handle_taster(void); void handle_lauflicht(void); void handle_timer(void); void setup() { pinMode(Button_Pin, INPUT_PULLUP); // Button an Pin 7, als Eingang (Pullups) schalten pinMode(LED_Pins[0], OUTPUT); // LEDs an den Pins 8-12 als Ausgang schalten pinMode(LED_Pins[1], OUTPUT); pinMode(LED_Pins[2], OUTPUT); pinMode(LED_Pins[3], OUTPUT); pinMode
in „Ein Taster - LED-Lauflicht starten/stoppen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Blink.ino
const uint8_t LED_CNT = 5; const uint8_t LED_PINS[LED_CNT] = {8, 9, 10, 11, 12}; const uint8_t BUTTON_PIN = 7; const uint32_t INTERVAL = 1000; uint32_t ms; uint32_t last_ms; uint32_t timeout; bool run; bool button; bool button_old; uint8_t actual_led; void update_timeout(void) { uint32_t diff_ms; ms = millis(); diff_ms = (ms - last_ms); last_ms = ms; if (diff_ms > timeout) timeout = 0; else timeout -= diff_ms; } void setup() { pinMode(BUTTON_PIN, INPUT_PULLUP); pinMode(LED_PINS[0], OUTPUT); pinMode(LED_PINS[1], OUTPUT); pinMode(LED_PINS[2], OUTPUT); pinMode(LED_PINS[3], OUTPUT); pinMode(LED_PINS
in „Ein Taster - LED-Lauflicht starten/stoppen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
lauflicht.ino
#include <Arduino.h> const int LED_Pins[5] = {8,9,10,11,12}; const int Button_Pin = 7; unsigned long Start_Millis = 0; unsigned long Current_Millis = 0; unsigned long Blinkwartezeit = 1000; uint8_t start = 0; uint8_t step = 0; uint8_t step_max = 5; void handle_taster(void); void handle_lauflicht(void); void handle_timer(void); void setup() { Serial.begin(115200); pinMode(Button_Pin, INPUT_PULLUP); // Button an Pin 7, als Eingang (Pullups) schalten pinMode(LED_Pins[0], OUTPUT); // LEDs an den Pins 8-12 als Ausgang schalten pinMode(LED_Pins[1], OUTPUT); pinMode(LED_Pins[2], OUTPUT); pinMode(LED_Pins
in „Ein Taster - LED-Lauflicht starten/stoppen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Basis.ino
#include <esp_now.h> #include <WiFi.h> #include <esp_wifi.h> // REPLACE WITH THE MAC Address of your receiver uint8_t broadcastAddress[] = {0x3C,0x61,0x05,0x30,0x9C,0xD4}; //anzupassen!!! uint8_t newMACAddress[] = {0x3C,0x61,0x05,0x32,0x22,0x4C}; //anzupassen!!! // Variable to store if sending data was successful String success; //Structure example to send data //Must match the receiver structure typedef struct struct_message { uint16_t mstrg1 =10; uint16_t mstrg2 =20; uint16_t mstrg3 =30; uint16_t mstrg4 =40; uint16_t mstrg5 =50; uint16_t mstrg6 =60; //Ersten 5 Bit Geschwindigkeit 6. Weiche,
in „ESPnow sendet nur die ersten 32 Bit“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Decoder.ino
#include <esp_now.h> #include <WiFi.h> #include <esp_wifi.h> // REPLACE WITH THE MAC Address of your receiver uint8_t broadcastAddress[] = {0x3C,0x61,0x05,0x32,0x22,0x4C}; //anzupassen!!! uint8_t newMACAddress[] = {0x3C,0x61,0x05,0x30,0x9C,0xD4}; //anzupassen!!! // Variable to store if sending data was successful String success; //Structure example to send data //Must match the receiver structure typedef struct struct_message { uint16_t mstrg1 =1; uint16_t mstrg2 =2; uint16_t mstrg3 =3; uint16_t mstrg4 =4; uint16_t mstrg5 =5; uint16_t mstrg6 =6; //Ersten 5 Bit Geschwindigkeit 6. Weiche, 7.Anforderung
in „ESPnow sendet nur die ersten 32 Bit“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Lueftersteuerung.ino
#include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SH110X.h> #include "DHT.h" //====================================== Temperatureinstellungen #define solltemp 18 #define stufe1 solltemp+4 #define stufe2 solltemp+5 #define stufe3 solltemp+6 #define stufe4 solltemp+8 #define stufe5 solltemp+10 //============================================================== #define DHTPIN 2 #define FanPin 9 #define DHTTYPE DHT22 #define i2c_Address 0x3c #define SCREEN_WIDTH 128 // OLED display width #define SCREEN_HEIGHT 64 // OLED display height #define OLED_RESET -1 // QT-PY / XIAO Adafruit_SH1106G
in „Probleme mit Arduino Uno und Oled Display“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Interrupt.ino
# define ROT 3 # define TASTER 2 volatile int tasterStatus = LOW; // aktuelles Signal vom Eingangspin volatile int tasterGedrueckt = 0; // abfragen ob Taster gedrückt war volatile int lichtmodus = 0; // festlegen der verschiedenen Lichtprogramme volatile int ledStatus = LOW; // aktueller Zusatnd der LED volatile int entprellZeit = 1000000; // Zeit für Entprellung, anpassen! unsigned long tasterZeit = 0; // Zeit beim drücken des Tasters unsigned long ledMillis = 0; // Zeit für den Blinkrythmus der LED volatile bool TasterStatus = LOW; void setup() { pinMode(ROT, OUTPUT); pinMode(LED_BUILTIN, OUTPUT
in „LED mit Taster ansteuern und Interrupt einfügen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
LON.ino
#include <WiFi.h> #include <WiFiUdp.h> #include <FS.h> #include <SPIFFS.h> #define MIN(a,b) ((a)<(b)?(a):(b)) #define MAX(a,b) ((a)<(b)?(b):(a)) const char * udpAddress = "192.168.0.255"; const int udpPort = 3333; const int udpPortIn = 3334; WiFiUDP lon_udp_out; WiFiUDP lon_udp_in; #define LON_RX 26 #define LON_TX 33 #define LON_TX_EN 25 #define LONSTATE_VERSION 0x0100 extern float tempsens_value; volatile uint32_t lon_rx_activity = 0; struct tm timeStruct; typedef struct { uint64_t magic1; uint32_t version; /* must not be used from stored state */ uint32_t stat_start_valid; struct tm stat_start
in „LON Bus Windhager mitlesen/steuern“ · Softwareentwicklung ·
-
Datei
MQTT.ino
#include <PubSubClient.h> #include "Adafruit_MQTT.h" #include "Adafruit_MQTT_Client.h" #define ARB_SERVER "192.168.xxx.xxx" #define ARB_CLIENT "MESWifi" #define ARB_SERVERPORT 1883 #define ARB_USERNAME "xxx" #define ARB_PW "xxx" WiFiClient client; PubSubClient mqtt(client); extern uint32_t lon_rx_count; extern uint32_t lon_crc_errors; int mqtt_last_publish_time = 0; int mqtt_lastConnect = 0; int mqtt_retries = 0; bool mqtt_fail = false; void callback(char* topic, byte* payload, unsigned int length) { Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i<length
in „LON Bus Windhager mitlesen/steuern“ · Softwareentwicklung ·
-
Datei
main.ino
#include <Arduino.h> #define warten_nach_press 300 // Ausgang Pin #define Relais1 12 #define Relais2 11 #define Relais3 10 #define Relais4 9 #define Relais5 8 #define Relais6 7 #define Relais7 6 #define Relais8 5 #define Relais9 4 #define Relais10 3 #define UP 2 #define DOWN A7 // / Segment Anzeige PIN Belegung #define a A2 #define b A3 #define c A4 #define d A5 #define e A6 #define f A1 #define g A0 /* a -------- | | f | | b |__g___| | | e | | c |__d___| */ // Reihenfolge a,b,c,d,e,f,g uint8_t pins_fuer_zahl[12][7] = { {a,b,c,d,e,f,0}, // 0 {b,c,0,0,0,0,0}, // 1 {a,b,d,e,g,0,0}, // 2 {a,b,g,e
in „Relais Umschalter mit up & down Tasten und Display“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Relaisboard.ino
#include <Arduino.h> #define warten_nach_press 300 // Ausgang Pin #define Relais1 12 #define Relais2 11 #define Relais3 10 #define Relais4 9 #define Relais5 8 #define Relais6 7 #define Relais7 6 #define Relais8 5 #define Relais9 4 #define Relais10 3 #define UP 2 #define DOWN 13 // / Segment Anzeige PIN Belegung #define a A2 #define b A3 #define c A4 #define d A5 #define e A6 #define f A1 #define g A0 /* a -------- | | f | | b |__g___| | | e | | c |__d___| */ // Reihenfolge a,b,c,d,e,f,g uint8_t pins_fuer_zahl[12][7] = { {a,b,c,d,e,f,0}, // 0 {b,c,0,0,0,0,0}, // 1 {a,b,d,e,g,0,0}, // 2 {a,b,g,e
in „Relais Umschalter mit up & down Tasten und Display“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Burst.ino
volatile uint8_t burst; void initBurst(void) { pinMode(9, OUTPUT); // OC2B, PH6 // mode 7, top=OCR2A, prescaler 1, non inverted PWM TCCR2A = _BV(COM2B1) | _BV(WGM20) | _BV(WGM21) ; TCCR2B = _BV(WGM22); TIMSK2 |= _BV(OCIE2B); // output compare 2A, trailing pulse edge } uint8_t configBurst(uint8_t cnt, uint8_t period, uint8_t width) { if ( (period < width) || (period - width) < 25) return 1; // zu wenig Zeit von fallender Flanke bis Periodenende TCCR2B = _BV(WGM22); OCR2A = period-1; OCR2B = width-1; TCNT2 = period-2; TIFR2 = _BV(OCF2B); // Interrupt löschen burst = cnt; return 0; } void triggerBurst
in „"Burst" mit atmega328 erzeugen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWM.ino
/* Takt_M328P.c Arduino UNO rev3 Created: 05.06.2022 Author : ukhl */ #include <avr/io.h> #include <avr/interrupt.h> #define LED (1<<PINB5) volatile uint16_t CTCon; volatile uint16_t CTCoff; volatile uint16_t freq100 = 1000; // Frequenz in 1/100 Hz; 1000 = 10,00 Hz ISR ( TIMER1_COMPA_vect ) { PORTB ^= LED; if ( PINB & LED ) { OCR1A = CTCon; } else { OCR1A = CTCoff; } } void init(void) { DDRB |= ( LED ); //// Timer TCCR1B |= (1 << WGM12) | (0 << CS12) | (1 << CS11) | (1 << CS10); // CTC , clk / 64 OCR1A = 25000000 / freq100 - 1; // wird im Timer Interrupt gesetzt. TIMSK1 |= (1 << OCIE1A); } int
in „Arduino Timerprobleme - suche programmierbaren Oszillator“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Ziel.ino
#include <ESP8266WiFi.h> #include <WiFiUdp.h> #include <TinyGPS++.h> #include <SoftwareSerial.h> // Set WiFi credentials #define WIFI_SSID "ESP8266" #define WIFI_PASS "12345678" // Set AP credentials #define AP_SSID "Zeitanalyse" #define AP_PASS "12345678" static const int TXPin = 40, RXPin = 0; static const uint32_t GPSBaud = 9600; unsigned int portziel = 3333; unsigned int porttablet = 7777; long zeit1, zeit2, stunden, minuten, sekunden, hundertstel, gpszeit, dif, durchgang; char allBuffer[255]; char packetBuffer[255]; char zielzeiten[255]; char zielbes[] = "Ziel bekommen"; char m[4] = "L6:"; bool
in „NodeMCU-ESP8266-Board“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
40.ino
#include <TinyGPS++.h> #include <ESP8266WiFi.h> #include <WiFiUdp.h> #include <SoftwareSerial.h> static const int TXPin = 4, RXPin = 5; static const uint32_t GPSBaud = 9600; unsigned int port = 2390; unsigned int port2 = 2400; long zeit1, zeit2, stunden, minuten, sekunden, hundertstel, gpszeit, dif, durchgang; char packetBuffer[255]; char zielBuffer[255]; char zielPacket[255]; char replyBuffer[] = "bekommen"; char m[4] = "L5:"; String gespacket; String komma = ","; bool L01 = false; bool L2 = false; bool L3 = false; bool L4 = false; bool L5 = false; WiFiUDP Udp; WiFiUDP Udp2; TinyGPSPlus gps;
in „NodeMCU-ESP8266-Board“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Mikrocontroller.ino
#include "U8glib.h" #include "Arduino.h" #define sensorPin 0 #define DELAY 10 const int cycles = 20; U8GLIB_LC7981_240X128 u8g(4, 5, 6, 7, 0, 1, 2, 3, 8, 9, 10, 11, 12); // 8Bit Com: D0..D7: 4,5,6,7,0,1,2,3 en=8, cs=9 ,di=10,rw=11, reset = 12 void setup(void) { } void u8g_prepare(void) { // u8g.setFont(u8g_font_profont12); // u8g.setFont(u8g_font_7x13B); u8g.setFont(u8g_font_osb21); // u8g.setFont(u8g_font_helvB10); // u8g.setFontRefHeightExtendedText(); // u8g.setDefaultForegroundColor(); // u8g.setFontPosTop(); } void draw(void) { // graphic commands to redraw the complete screen should be placed
in „GLCD mit Arduino soll Variable anzeigen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sender.ino
/* Rui Santos Complete project details at https://RandomNerdTutorials.com/esp-now-one-to-many-esp8266-nodemcu/ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. */ #include <ESP8266WiFi.h> #include <espnow.h> // REPLACE WITH RECEIVER MAC Address //uint8_t broadcastAddress1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint8_t broadcastAddress2[] = {0xCC, 0x50, 0xE3, 0x6A, 0x9A, 0xAB}; // Structure
in „nodemcu mit espnow verbinden“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Durchfluss.ino
#define SIGNAL_INPUT 2 #define PPL 22000 uint32_t edge_count; void init_timer(void) { cli(); TCCR1A = 0;// set entire TCCR1A register to 0 TCCR1B = 0;// same for TCCR1B TCNT1 = 0;//initialize counter value to 0 // set compare match register for 1hz increments OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536) // turn on CTC mode TCCR1B |= (1 << WGM12); // Set CS12 and CS10 bits for 1024 prescaler TCCR1B |= (1 << CS12) | (1 << CS10); // enable timer compare interrupt TIMSK1 |= (1 << OCIE1A); sei(); } void setup() { Serial.begin(38400); pinMode(SIGNAL_INPUT, INPUT_PULLUP); pinMode(3, OUTPUT
in „Hilfe bei Sensor und Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
waage.ino
// Einbindung aller benötigten Bibliotheken #include <HX711_ADC.h> // in der Version 1.2.7 verwendet #include <EEPROM.h> // als Standard Bibliothek in der Arduino IDE integriert #include <SPI.h> // als Standard Bibliothek in der Arduino IDE integriert #include <SD.h> // als Standard Bibliothek in der Arduino IDE integriert // Pinbelegung der angeschlossenen Sensoren #define HX711_DOUT_1 4 // Sensor 1 (50kg) DOUT -> Arduino Pin 4 #define HX711_CLK_1 5 // Sensor 1 (50kg) CLK -> Arduino Pin 5 #define HX711_DOUT_2 6 // Sensor 2 (100kg) DOUT -> Arduino Pin 6 #define HX711_CLK_2 7 // Sensor 2 (100kg)
in „Arduino auf SD-Karte kann nicht geschrieben werden“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
beispiel.ino
#include <SPI.h> #include <SD.h> #include <OneWire.h> #include <DallasTemperature.h> #define ONE_WIRE_BUS 7 // Data wire is plugged into pin 7 of the arduino // Setup a OneWire instance to communicate with any OneWire devices OneWire oneWire(ONE_WIRE_BUS); // Pass OneWire reference to Dallas Temperature DallasTemperature sensors(&oneWire); const int chipSelect = 10; long id = 0; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } sensors.begin(); // Start up the library
in „Arduino auf SD-Karte kann nicht geschrieben werden“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
waage.ino
// Einbindung aller benötigten Bibliotheken #include <HX711_ADC.h> // in der Version 1.2.7 verwendet #include <EEPROM.h> // als Standard Bibliothek in der Arduino IDE integriert #include <SPI.h> // als Standard Bibliothek in der Arduino IDE integriert #include <SD.h> // als Standard Bibliothek in der Arduino IDE integriert // Pinbelegung der angeschlossenen Sensoren #define HX711_DOUT_1 4 // Sensor 1 (50kg) DOUT -> Arduino Pin 4 #define HX711_CLK_1 5 // Sensor 1 (50kg) CLK -> Arduino Pin 5 #define HX711_DOUT_2 6 // Sensor 2 (100kg) DOUT -> Arduino Pin 6 #define HX711_CLK_2 7 // Sensor 2 (100kg)
in „Arduino auf SD-Karte kann nicht geschrieben werden“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
waage.ino
// Einbindung aller ben�tigten Bibliotheken #include <HX711_ADC.h> // in der Version 1.2.7 verwendet //#include <EEPROM.h> // als Standard Bibliothek in der Arduino IDE integriert #include <SPI.h> // als Standard Bibliothek in der Arduino IDE integriert #include <SD.h> // als Standard Bibliothek in der Arduino IDE integriert // Pinbelegung der angeschlossenen Sensoren #define HX711_DOUT_1 4 // Sensor 1 (50kg) DOUT -> Arduino Pin 4 #define HX711_CLK_1 5 // Sensor 1 (50kg) CLK -> Arduino Pin 5 #define HX711_DOUT_2 6 // Sensor 2 (100kg) DOUT -> Arduino Pin 6 #define HX711_CLK_2 7 // Sensor 2 (100kg
in „Arduino auf SD-Karte kann nicht geschrieben werden“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
karadioutils.ino
int freeRam () { extern int __heap_start, *__brkval; int v; return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); } /* void removeUtf8(byte *characters) { int index = 0; while (characters[index]) { if ((characters[index]) == 195) { characters[index] = 'x'; // Serial.println((characters[index])); characters[index+1] +=64; int sind = index+1; switch(characters[sind]) { case 0xFF: case 0xFD: characters[sind] = 'y'; break; case 0xDF: characters[sind] = 'Y'; break; case 0xE7: characters[sind] = 'c'; break; case 0xC7: characters[sind] = 'C'; break; case 0xF2: case 0XF3: case 0xF4: case
in „Probleme mit Arduino Setup“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
mc.ino
#define F_CPU 8000000UL //8Mhz ATtiny44 const int ledPin1 = 0; // the number of the first LED pin const int ledPin2 = 1; // the number of the second LED pin const int buttonPin = 2; // the number of the pushbutton pin const int raspiPwr = 3; // the raspberipi powerswitch pin const int raspi = 4; // the raspberipi shutdown signal pin const int testled =7; // Only test led int buttonState = 0; // variable for reading the pushbutton status int raspiPwrState = 0; // variable for reading if raspi PWR is turned on or off void setup() { // initialize the LED pins as an output: pinMode(ledPin1, OUTPUT
in „Raspberry Pi 3 Schalter“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
touchscreendemoshield.ino
// Touch screen library with X Y and Z (pressure) readings as well // as oversampling to avoid 'bouncing' // This demo code returns raw readings, public domain #include <stdint.h> #include "TouchScreen.h" // These are the pins for the shield! #define YP A1 // must be an analog pin, use "An" notation! #define XM A2 // must be an analog pin, use "An" notation! #define YM 7 // can be a digital pin #define XP 6 // can be a digital pin #define MINPRESSURE 10 #define MAXPRESSURE 1000 // For better pressure precision, we need to know the resistance // between X+ and X- Use any multimeter to read it /
in „Arduino Display Probleme“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Hauptprogramm.ino
/* * Kinderwagen mit E-Antrieb * Version 1.0 * * 17.03.2017 * * Treibt zwei DC-12V-Motoren mittels PWM an. * Das Ganze wird über einen Joystick (ADC) gesteuert oder * mittels Bluetooth-Modul und Schalter ("Remote-Control ON/OFF") * via Handy-App gesteuert. * Details siehe Schaltplan... * */ #define BAUDRATE 9600 #define BRAKEVCC 0 #define CLOCKWISE 1 // Clockwise (im Uhrzeigersinn) #define COUNTERCLOCKWISE 2 // Counterclockwise (gegen den Uhrzeigersinn) #define BRAKEGND 3 #define CS_THRESHOLD 15 // Safety current #define CLOCKWISE_MOTOR_0 9 // Pin am Arduino, der die Drehrichtung von Motor_0 im
in „Seltsames Verhalten - Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Hauptprogramm.ino
/* * Kinderwagen mit E-Antrieb * Version 1.0 * * 17.03.2017 * * Treibt zwei DC-12V-Motoren mittels PWM an. * Das Ganze wird über einen Joystick (ADC) gesteuert oder * mittels Bluetooth-Modul und Schalter ("Remote-Control ON/OFF") * via Handy-App gesteuert. * Details siehe Schaltplan... * */ #define BAUDRATE 9600 #define BRAKEVCC 0 #define CLOCKWISE 1 // Clockwise (im Uhrzeigersinn) #define COUNTERCLOCKWISE 2 // Counterclockwise (gegen den Uhrzeigersinn) #define BRAKEGND 3 #define CS_THRESHOLD 15 // Safety current #define CLOCKWISE_MOTOR_0 9 // Pin am Arduino, der die Drehrichtung von Motor_0 im
in „Seltsames Verhalten - Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Kinderwagen.ino
//Set to 0, when println are delivering good results #define DEBUG 1 //ADC Values when joystick is not pressed #define DIRECTION_ZERO 518 #define HEADING_ZERO 526 //ADC Threshold to exceed before Joystick is turned into motor movement #define DEADZONE_DIRECTION 20 #define DEADZONE_HEADING 20 //Max speed the motors can run #define MAX_PWM_DIRECTION 255 #define MAX_PWM_HEADING 255 //Enumeration for easier reading typedef enum { STOP = 0, LEFT = 1, RIGHT = 2, FORWARD = 3, BACKWARD = 4 } MotorMovement; //Pin definition int Motor_Left_Pin = 0; //OUTPUT int Motor_Right_Pin = 0; //OUTPUT int Motor_Direction_Speed_Pin
in „Joystickauswertung via Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test.ino
#include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 7, 8, 9, 10); int pin_poti = 0; //Schleifer von Poti auf A0 int zeit=0; void setup() { lcd.begin(16,2); Serial.begin(9600); } void loop() { pin_poti=analogRead(0); // Potistelleung einlesen zeit=map(pin_poti,0,1023,500,6000); //Alarmdauer in ms ausrechnen (map(tasterstatusue, fromLow, fromHigh, toLow, toHigh)) lcd.setCursor(0, 0); lcd.print((float) zeit/1000.0); //Zeit in Sekunden ausgeben lcd.print(" sec"); Serial.println((float) zeit/1000.0); }
in „Gleitkommazahl auf MAX7219 7-segment“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Lauflicht.ino
// Lauflicht aller LEDS // STM32F4 Discovery #define GREENLED PD12 #define ORANGELED PD13 #define GREDLED PD14 #define BLUELED PD15 #define REDLEDOTGOVERCURRENT PD5 #define NUMLEDS 5 const uint8_t Led[] = {GREENLED, ORANGELED, GREDLED, BLUELED, REDLEDOTGOVERCURRENT}; void setup() { for (int n = 0; n < NUMLEDS; n++) pinMode(Led[n], OUTPUT); } void setLed(uint8_t n, uint8_t state) { digitalWrite(Led[n], state); } void loop() { for (int n = 0; n < NUMLEDS; n++) { setLed(n, HIGH); delay(100); setLed(n, LOW); delay(100); } }
in „STM32F4 Discovery Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PWMAUDIO.ino
#include <stdint.h> #include <WebSocketsServer.h> #include <ESP8266WiFi.h> #include <ESP8266WebServer.h> #include <ESP8266mDNS.h> #include "FS.h" #include <Arduino.h> #include "interrupts.h" extern "C" { #include "user_interface.h" #include "ets_sys.h" } //define globals #define TX_PIN 2//gpio 0 zum senden #define RX_PIN 0//gpio 2 zum empfangen #define bufferSize 16384 #define BUFFER_MASK (bufferSize-1) const char ssid[] = "apatchefriend2016"; // your network SSID (name) const char pass[] = "$xamPP678Denny"; // your network password const char myHostname[] = "ESP-01"; uint8_t clientIP = NULL;
in „PWM Audio mit ESP8266, schlechte Qualitaet, -Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pulselength.ino
int pulsepin = 7; unsigned long high = 0; int pulseA = 0; int pulseB = 0; int mstoleranz = 10; int pulsecount = 0; int numa, numb, numc, numd = 0; int terminate = 0; void setup() { pinMode(pulsepin, INPUT); } void loop() { // put your main code here, to run repeatedly: } void getpulselengtha(){ high = pulseIn(pulsepin, HIGH); pulseA = high/1000; getpulselengthb(); } void getpulselengthb(){ high = pulseIn(pulsepin, HIGH); pulseB = high/1000; } void compare(){ if (pulseA-mstoleranz < pulseB+mstoleranz && pulseB-mstoleranz < pulseA+mstoleranz) { pulsecount++; getpulselengtha(); } else getnewpulse
in „Semikolon nach if-Abfrage?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
rfid.ino
#include <SPI.h> #include <MFRC522.h> #define uchar unsigned char #define uint unsigned int //data array maxium length #define MAX_LEN 16 ///////////////////////////////////////////////////////////////////// //set the pin ///////////////////////////////////////////////////////////////////// const int chipSelectPin = 10;//cs control const int NRSTPD = 13;//Reset //MF522 command bits #define PCD_IDLE 0x00 //NO action; cancel current commands #define PCD_AUTHENT 0x0E //verify password key #define PCD_RECEIVE 0x08 //receive data #define PCD_TRANSMIT 0x04 //send data #define PCD_TRANSCEIVE 0x0C //send
in „Arduino leonardo invalid suffix "B9FD4" umgehen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Luftsensor.ino
/* OLED arduino D0-----------10 D1-----------9 RST----------13 DC-----------11 VCC----------5V GND----------GND*/ int SCL_PIN=10;//D0 int SDA_PIN=9; //D1 int RST_PIN=13;//RST int DC_PIN=11; //DC void LED_CLS(void); void LED_Set_Pos(unsigned char x,unsigned char y);//Set the coordinate void LED_WrDat(unsigned char data); //Write Data void LED_P6x8Char(unsigned char x,unsigned char y,unsigned char ch); void LED_P6x8Str(unsigned char x,unsigned char y,unsigned char ch[]); void LED_P8x16Str(unsigned char x,unsigned char y,unsigned char ch[]); void LED_PrintBMP(unsigned char x0,unsigned char y0,unsigned
in „China Arduino zu kleiner flash Speicher?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ausgangspositionmitte.ino
/*************************************************** This is an example for our Adafruit 16-channel PWM & Servo driver Servo test - this will drive 16 servos, one after the other Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/815 These displays use I2C to communicate, 2 pins are required to interface. For Arduino UNOs, thats SCL -> Analog 5, SDA -> Analog 4 Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries
in „Roboterarm mit Gestensteuerung HILFE I2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Firmware.ino
//Include the LCD library code // The OLED I used is from Adafruit // Monochrome 1.3" 128x64 OLED graphic display #include <LiquidCrystal.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <SPI.h> #define OLED_CS 8 #define OLED_RESET 9 #define OLED_DC 10 #define OLED_CLK 11 #define OLED_MOSI 12 Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); #define LOGO16_GLCD_HEIGHT 16 #define LOGO16_GLCD_WIDTH 16 #define RPM_Sensor_Input 1 //can be int 0,1,2, or 3 but NB: 2 and 3 is serial comms const int ledPin = 13; // If you have a LED connected /
in „Fehlermeldung beim Kompilieren mit arduino 1.06“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Testprogramm.ino
#include <RGBColor.h> #include <RGBLED.h> RGBColor green = RGBColor(0, 100, 0); RGBLED rgbLED = RGBLED(9, 10, 11, 0, 2, 1); //Pins vom Arduino 9,10,11 void setup() { Serial.begin (9600); rgbLED.setIntensity(100); rgbLED.crossfade(green); //Farbe Ausgeben } void loop() { int RED = RGBLED.GetRed(); int GREEN = RGBLED.GetGreen(); int BLUE = RGBLED.GetBlue(); Serial.println ("Farben:"); Serial.print ("Rot: "); Serial.println (RED); Serial.print ("Grün: "); Serial.println (GREEN); Serial.print ("Blau: "); Serial.println (BLUE); Serial.println ("#######"); }
in „Hilfe zu Arduino Library“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Monoflop.ino
/* Monoflop 2016-03-27 This example code is in the public domain */ #define SteuerPin 2 #define AusgabePin 13 #define DAUER 50 #define INTERVAL_ms 10 unsigned long time_ms, nexttime; void setup() { //start serial connection Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } delay(3000); Serial.println("Weichensteuerung"); //configure SteuerPin as an input and enable the internal pull-up resistor pinMode(SteuerPin, INPUT_PULLUP); pinMode(AusgabePin, OUTPUT); digitalWrite(AusgabePin, LOW); } void loop() { static int Eingang1_alt = HIGH;
in „Arduino Uno und analoge Märklin-Weichen“ · Mikrocontroller und Digitale Elektronik ·