-
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 ·
-
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 ·
-
Datei
pt1000_rp2040.ino
/* Beispielprogramm fuer einfache PT1000-Messung mit einem RP2040 pico. Zur Vermeidung von Eigenerwärmung wird der PT1000 in den Messpausen spannungslos geschaltet (kurzgeschlossen). http://www.mino-elektronik.de Alle Angaben ohne Gewaehr ! 2022-03-22 */ #define OFFSET 16 // 0-Offset des ADCs #define DEF_BAUDRATE 19200 #define ADC_MAX (4095 - OFFSET) // bei 12 Bit #define PT_IN_0 26 // analog Eingang A0 #define UEBERLAUF 9999 // Fehler bei offenem Eingang #define R_PT0 1000.0 // bei 0 Grad C #define R_REF 1000.0 // ext. Widerstand mit 0,1% #define R_ZULEITUNG 0 // bei laengeren Leitungen unbedingt
in „Problem bei Temp-Messung Rasp. Pi Pico & Pt1000“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
pt1000_rp2040.ino
/* Beispielprogramm fuer einfache PT1000-Messung mit einem RP2040 pico. Zunächst die Schaltungsbeschreibung: Der zu messende PT1000-Widerstand liegt mit einem Ende an GND und mit dem anderen Anschluss am Eingang A0 (PT_IN_0). Vom Anschluss ADC_VREF (typ. 3,3 v) des RP204-pico-Boards geht ein Widerstand R_REF 1000 Ohm 0,1% ebenfalls an den Eingang A0. Der PT1000-Widerstand und der 1000 Ohm Widerstand bilden somit einen Spannungsteiler, der bei 0 Grad C die Spannung an AREF genau 1:2 teilt. Zum Programm: Das Programm macht 5 Messungen/s und gibt die ermittelte Temperatur in Grad C per UART1 (an GP0
-
Datei
PDM_2SpgE.ino
/*1.0 2 Spannungsebenen * Pulsdauermodulation * Arduino Micro * Ausgang OCR1B muss invertiert sein */ #include <util/atomic.h> #define F_PWM 62500L //Hz #define PRESCALER 1 #define TIMER_RELOAD ((F_CPU / ( PRESCALER * F_PWM) -1)) //Fast PWM //Variablen volatile uint16_t Frequenz; volatile uint8_t Amplitude, Amplitude_inv; static uint16_t i; const int8_t Sinus[256] PROGMEM = {0,3,6,9,12,16,19,22,25,28,31,34,37,40,43,46,49, 51,54,57,60,63,65,68,71,73,76,78,81,83,85,88,90,92,94,96,98,100,102,104,106,107,109, 111,112,113,115,116,117,118,120,121,122,122,123,124,125,125,126,126,126,127,127,127, 127,127,127,127,126,126,126,125,125,124,123,122,122,121,120,118,117,116,115,113,112
in „Arduino Micro SPWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
PDM_2SpgE.ino
/* 2 Spannungsebenen * Pulsdauermodulation * Arduino Micro */ #define F_PWM 62500L //Hz #define PRESCALER 1 #define TIMER_RELOAD ((F_CPU / ( PRESCALER * F_PWM) -1)) //Fast PWM //Variablen volatile uint16_t Frequenz; volatile uint8_t Amplitude; const int8_t Sinus[256] PROGMEM = {0,3,6,9,12,16,19,22,25,28,31,34,37,40,43,46,49, 51,54,57,60,63,65,68,71,73,76,78,81,83,85,88,90,92,94,96,98,100,102,104,106,107,109, 111,112,113,115,116,117,118,120,121,122,122,123,124,125,125,126,126,126,127,127,127, 127,127,127,127,126,126,126,125,125,124,123,122,122,121,120,118,117,116,115,113,112, 111,109,107,106,104,102,100,98,96,94,92,90,88,85,83,81,78,76,73,71,68,65,63,60,57
in „Arduino Micro SPWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Code_Fertig_mit_analog_sensoren.ino
//Initialisierung Helligkeitssensor char Helligkeitssensor1 = A0; char Helligkeitssensor2 = A1; char Helligkeitssensor3 = A2; char Helligkeitssensor4 = A3; char Helligkeitssensor5 = A4; char Helligkeitssensor6 = A5; //Initialisierung LEDs char LED1 = 9; char LED2 = 8; char LED3 = 7; char LED4 = 6; char LED5 = 5; char LED6 = 4; //Initialisierung Hilfsvariablen char x1 = 0; char x2 = 0; char x3 = 0; char x4 = 0; char x5 = 0; char x6 = 0; char Sensor_Schritt1= 0; char Sensor_Schritt2= 0; char Sensor_Schritt3= 0; char Sensor_Schritt4= 0; char Sensor_Schritt5= 0; char Sensor_Schritt6= 0; char LED_war_H
in „Reihenfolge von Tastern merken Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
timer_7_8_herz.ino
// timer grundlage für 7,8 hz 'schumann frequenz' // OCR1A = ((CPU frequ/Prescaler * ISR frequ)) -1 isr frqu = gewünschte frequenz void setup() { pinMode(11,OUTPUT); // led pin 50 hz ausgang // start timer setup // timer setup for highly preceised timed measurements cli(); // stop all interrupts // turn on CTC mode TCCR1A = 0; // set entire TCCR1A register to 0 TCCR1B = 0; // same for TCCR1B TCCR1B |= (1 << WGM12); // set CS11 bit for prescaler 8 TCCR1B |= (1 << CS11); // initialize counter value to 0 TCNT1 = 0; // set timer count for 50 hz increments OCR1A = 39999; // = (16*10^6) / (50*8) -1
in „50 Hertz mit Timer“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
timer_7_8_Hz.ino
// Timer Grundlage für 7,8 Hz 'schumann frequenz' #define F_OUT 50L // Hz #define PRESCALER 64 #define TIMER_RELOAD ((F_CPU/(PRESCALER * F_OUT))-1) #if TIMER_RELOAD >65535 #error TIMER_RELAOD > 65535, F_OUT oder PRESCALER erhöhen #endif void setup() { pinMode(11,OUTPUT); // OCR1A // Timer1 initialisieren // Mode 14, Fast PWM (ICR1), nichtinvertierte PWM, Prescaler 64 // OCR1A aktiv TCCR1A = (1<<COM1A1) | (1<<WGM11); TCCR1B = (1<<WGM13) | (1<<WGM12) | (1<<CS11) | (1<<CS10); ICR1 = TIMER_RELOAD; OCR1A = TIMER_RELOAD / 2; // 50% Tastverhältnis } void loop() { // put your main code here, to run repeatedly
in „50 Hertz mit Timer“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_may08a.ino
// https://forum.arduino.cc/t/auslesen-der-easymeter-q3m-d0-schnittstelle/548183 int invertirpin = 6; void setup() { Serial.begin(9600); pinMode(invertirpin,OUTPUT); digitalWrite(invertirpin,HIGH); // HIGH non inv; low inv 74LS02 als xor vor Reciver-Pin } byte incomingByte; String sMessage = ""; void loop() { while (Serial.available() > 0) { incomingByte = Serial.read(); if (incomingByte < 0x10) sMessage += "0"; sMessage += String(incomingByte, HEX); sMessage += " "; } if(sMessage != ""){ Serial.println(sMessage); sMessage = ""; } }
in „Arduino Nano Easymeter Q3BA auslesen und Shuntregler“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_may09a.ino
// https://forum.arduino.cc/t/auslesen-der-easymeter-q3m-d0-schnittstelle/548183 int invertirpin = 6; // Phasenanschnitt bool nulldurchgang; int ausgpin = 3; unsigned long startn; unsigned long istn; unsigned long anschnitt = 6000; unsigned long solln; bool phasenanschnitt; bool phasenanschnittvorher; bool triactrigger; bool ausg; // aktiviert den Phasenanschnitt // Testpins int ledgelbpin = 4; int ledgruenpin = 5; void setup() { Serial.begin(9600); pinMode(invertirpin,OUTPUT); digitalWrite(invertirpin,HIGH); // HIGH non inv; low inv 74LS02 als xor vor Reciver-Pin pinMode(ledgelbpin,OUTPUT); pinMode
in „Arduino Nano Easymeter Q3BA auslesen und Shuntregler“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
frequencyGeneratorCounterScpi.ino
/* Function Generator and Frequency Counter with SCPI parser setup: 1. programm your Arduino 2. addapt the serial port in your python script to the serial port used on your PC 3. run the python script PC: python with tkinter and pyserial MC: any Arduino YY.MM.DD 22.05.06 first version of function generator by mchris 22.05.08 V0.2, SCPI parser lib included by mchris 22.05.14 V0.2, frequency counter added by mchris Use SCPI library from https://github.com/Vrekrer/Vrekrer_scpi_parser */ #include "Arduino.h" #include "Vrekrer_scpi_parser.h" SCPI_Parser my_instrument; #define COUNTERINPUT_PIN 6 #define FREQENCY_PIN
-
Datei
Multi_Pulse_Gen_DDS.ino
/* Mehrfachpulsgenerator mittels DDS Ausgabe von vier Digitalsignalen mit variabler Frequenz und Phase Auflösung der Variablen R(frequenz) : F_TIMER / 2^16 = 6552Hz / 65536 = 0,1 Hz R(phase) : 360° / 256 = 1,4° = 0,025 rad */ #include <util/atomic.h> #define F_TIMER 6552L // Hz #define PRESCALER 1 #define TIMER_RELOAD ((F_CPU / ( PRESCALER * F_TIMER) -1)) // Fast PWM // Variablen volatile uint16_t accu[4], frequenz[4]; volatile uint8_t phase[4]; // freq100mHz in 0,1 Hz, 0-(F_TIMER*10)/2 uint16_t setFrequency(uint16_t freq100mHz) { return ((uint32_t)freq100mHz<<16)/(F_TIMER*10); } // phaseDeg in
in „Arduino Timerprobleme - suche programmierbaren Oszillator“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Profibus_DP_slave_mega.ino
//adattamento mio per l'Arduino Mega, senza usare quello già fatto da Tadej S. //#include <Servo.h> #include <LiquidCrystal.h> //Servo myservo; il servo non funziona se poi manipolo i timer #define BAUD 45450 // DELAY_TBIT = 44 // Working on Arduino @16MHz //#define trimmer A0 //#define led 5 //#define servo 10 #define piu A14 #define meno A15 #define jolly A12 #define rs 12 #define en1 11 #define d4 4 #define d5 5 #define d6 6 #define d7 7 #define en2 10 //----------ingressi---------- byte PGNO = 0; //byte 0 #define PGNO_PARITY 14 //bit 0 del byte 1 #define PGNO_VALID 15 //bit 1 del byte 1 #define
-
Datei
sketch_jan18b.ino
#include "SSD1306Ascii.h" #include "SSD1306AsciiAvrI2c.h" template<typename DatenType> class GleitenderMittelwert // eher Tiefpassfilter { private: const double factor; double mittelwert; public: GleitenderMittelwert(const double factor):factor(factor),mittelwert(0){} void setInitial(DatenType value) { mittelwert = value; } DatenType doValue(DatenType value) // neuen Wert verarbeiten { mittelwert *= 1.0 - factor; mittelwert += factor * value; return mittelwert; } DatenType operator= (DatenType value) { return doValue(value); } DatenType operator() (DatenType value) { return doValue(value); } DatenType
in „Arduino-Programm für Tankanzeige. Tankfüllstandsmessung.“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test_256kB.ino
/* * Test ArduinoMEGA with PROGMEM data above 64kB * access via pgm_read_byte_far() from pgmspace.h */ // get the 32bit far address of an object #define FAR_ADR(var) \ ({ \ uint32_t tmp; \ __asm__ __volatile__( \ "ldi %A0, lo8(%1)" "\n\t" \ "ldi %B0, hi8(%1)" "\n\t" \ "ldi %C0, hh8(%1)" "\n\t" \ "clr %D0" "\n\t" \ : "=d" (tmp) \ : "p" (&(var)) \ ); \ tmp; \ }) /******************************************************************** * Define a section above 64kiB ********************************************************************/ //-----------------------------------------------------------------
in „AVR Flash jenseits der 64kB“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test_256kB.ino
/* * Test ArduinoMEGA with PROGMEM data above 64kB * access via pgm_read_byte_far() from pgmspace.h */ /******************************************************************** * Define an additional section, which will be placed after all others ********************************************************************/ //-------------------------------------------------------------------- #define FAR_SECTION __attribute__((__section__(".far_section"))) //-------------------------------------------------------------------- /******************************************************************** * modify the
in „AVR Flash jenseits der 64kB“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
01_bme_280_a.ino
/*************************************************************************** This is a library for the BME280 humidity, temperature & pressure sensor Designed specifically to work with the BME280 Breakout board – --> http://www.adafruit.com/products/2650 This sketch only supports the I2C bus for connection. ***************************************************************************/ #include <Wire.h> #include "cactus_io_BME280_I2C.h" BME280_I2C bme(0x76); // I2C using address 0x76 void setup() { Serial.begin(9600); Serial.println("BME280 Luftdruck, Luftfeuchtigkeit, Temperatur Sensor | cactus.io"); Serial.println
in „Arduino SD und BME280“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_feb10b.ino
template<typename MeinDatenType> MeinDatenType funktion() { return 42; } void setup() { Serial.begin(9600); Serial.println(funktion<float>()); Serial.println(funktion<byte>()); Serial.println(funktion<char>()); } void loop() {}
in „AVR C Programmierung unter Linux“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_feb24a.ino
#include <ESP8266WiFi.h> #include <PubSubClient.h> //-------Wifi infos --------- const char* ssid = "<ssid>"; const char* password = "<pw>"; const int wifiRetryInterval = 500; //-------MQTT infos --------- char* clientId = "Wassermelder1"; const char* mqttServerIp = "<mqtt_server_ip>"; const int mqttServerPort = 1883; const char* mqttUser = "<mqtt user>"; const char* mqttPassword = "<mqtt pw>"; const int mqttRetryInterval = 2000; const char* topicWassermelder = "esp/wassermelder1"; WiFiClient espClient; PubSubClient mqttClient(espClient); void setup() { initWifi(); initMQTT(); delay(1000); } void loop()
in „ESP01-S Wassermelder“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Temp_LAN_display_Volt.ino
//Display 11, 10 ,9, 6, 5, 4) //LED 13 //Lan SPI: 53 SS) /51 MOSI /50 MISO /52 SCK //Lan karte 10 SS /11 MOSI /12 MISO /13 SCK //Inter. 0 = Digitaler Pin 2 // Temp all 22 //Kühlschrank 24 //0-15A Spannungsmessung #include <UIPEthernet.h> #include <SPI.h> #include <DallasTemperature.h> #include <LiquidCrystal.h> EthernetClient client; EthernetServer server(80); byte mac[] = { 0x54, 0x55, 0x58, 0x10, 0x00, 0x24 }; // entspricht einer MAC von 84.85.88.16.0.36 byte ip[] = { 192, 168, 2, xxx }; // IP-Adresse byte gateway[] = { 192, 168, 2, 1 }; // Gateway byte subnet[] = { 255, 255, 255, 0 }; String readString
in „atmaga2560 + Interrupt + lan = abbruch.“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_feb24d.ino
#include <LiquidCrystal.h> #include <SPI.h> const int chipSelectPinADC = 9; //Using pin 9, but pin 10 would also be fine unsigned int result = 0; //Use 16-bits to store the 12-bit result byte inByte = 0; unsigned long y = 0; unsigned int result2 = 0; LiquidCrystal lcd(3, 4, 2, 5, 6, 7); void setup() { lcd.begin(16, 2); SPI.begin(); SPI.setBitOrder(MSBFIRST); //How to read in SPI data, most significant bit first pinMode(10,OUTPUT); pinMode(chipSelectPinADC, OUTPUT); //select the pin to control the MCP3201 digitalWrite(chipSelectPinADC, HIGH); //set the pin high at initialize } void loop() { for
in „MCP3201 ADC Probleme“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_feb24d.ino
#include <LiquidCrystal.h> #include <SPI.h> const int chipSelectPinADC = 9; //Using pin 9, but pin 10 would also be fine unsigned int result = 0; //Use 16-bits to store the 12-bit result byte inByte = 0; int z =0; unsigned long y = 0; unsigned int result2 = 0; LiquidCrystal lcd(3, 4, 2, 5, 6, 7); void setup() { lcd.begin(16, 2); SPI.begin(); SPI.setBitOrder(MSBFIRST); //How to read in SPI data, most significant bit first pinMode(chipSelectPinADC, OUTPUT); //select the pin to control the MCP3201 digitalWrite(chipSelectPinADC, HIGH); //set the pin high at initialize } void loop() { lcd.clear(); result
in „MCP3201 ADC Probleme“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_GRBL_LCD_ESP_wf.ino
/* */ #include "SPI.h" #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" #define TFT_DC 15 #define TFT_CS 2 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); unsigned long previousMillis = 0; const int SERIAL_BUFFER_SIZE = 20; char serialBuffer[SERIAL_BUFFER_SIZE]; const unsigned char END_CHAR = 0xFF; void setup ( void ) { SPI.begin(); tft.begin(); tft.setRotation(0); tft.setCursor(0, 0); tft.fillScreen(ILI9341_BLACK); tft.setTextSize(2); tft.fillRect(0, 32, 240, 110, ILI9341_BLUE); tft.setTextColor(ILI9341_WHITE); tft.setCursor(20, 10); tft.print ( "SCC-GRBL Display" ); Serial.begin(115200
in „Projekt: SerialComCNC Serielles Frontend für CNC GRBL mit ATMega“ · Projekte & Code ·
-
Datei
_GRBL_LCD_ESP_wf.ino
#include "SPI.h" #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" // ESP-8266: #define TFT_DC 15 #define TFT_CS 2 //// Arduino-UNO: //#define TFT_DC 3 //#define TFT_CS 2 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); unsigned long previousMillis = 0; const int SERIAL_BUFFER_SIZE = 20; char serialBuffer[SERIAL_BUFFER_SIZE]; char lcdBuffer[10]; const unsigned char END_CHAR = 0xFF; unsigned char c = '0'; void setup ( void ) { SPI.begin(); tft.begin(); tft.setRotation(0); tft.setCursor(0, 0); tft.fillScreen(ILI9341_BLACK); tft.setTextSize(2); tft.fillRect(0, 32, 240, 110, ILI9341_BLUE
in „Projekt: SerialComCNC Serielles Frontend für CNC GRBL mit ATMega“ · Projekte & Code ·
-
Datei
_GRBL_LCD_UNO_wf.ino
// Arduino Nano Pinbelegung: // // D0 // D1 // D2 GLCD Pin x (Data 0) // D3 GLCD Pin x (Data 1) // D4 GLCD Pin x (Data 2) // D5 GLCD Pin x (Data 3) // D6 GLCD Pin x (Data 4) // D7 GLCD Pin x (Data 5) // D8 GLCD Pin x (Data 6) // D9 GLCD Pin x (Data 7) // D10 // D11 GLCD Kontrast (PWM) // D12 // D13 // A0 GLCD Pin x (WR) // A1 GLCD Pin x (RD) // A2 GLCD Pin x (CE) // A3 GLCD Pin x (CD) // A4 // A5 // A6 // A7 #include "T6963.h" T6963 LCD(128, 128, 6, 32); // 128x128 Pixel and 6x8 Font unsigned long previousMillis = 0; const int SERIAL_BUFFER_SIZE = 20; char serialBuffer[SERIAL_BUFFER_SIZE]; char
in „Projekt: SerialComCNC Serielles Frontend für CNC GRBL mit ATMega“ · Projekte & Code ·
-
Datei
TX_433Mhz_Robot.ino
#include <SoftwareSerial.h> SoftwareSerial BTserial(2, 3); // RX | TX char *controller; int x; int y; int led; void setup() { pinMode(13, OUTPUT); Serial.begin(9600); BTserial.begin(9600); controller = "0"; } void loop() { x = analogRead(A0); y = analogRead(A1); led = analogRead(A2); if (x > 0 && x < 250) { BTserial.write("A"); } else if (x > 250 && x < 400) { BTserial.write("B"); } else if (x > 500 && x < 520 && y > 500 && y < 520) { BTserial.write("C"); } else if (x > 600 && x < 750) { BTserial.write("D"); } else if (x > 750 && x < 1050) { BTserial.write("E"); } else if (y > 0 && y < 250) {
in „Prozessor bleibt bei case switching hängen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_mar22a.ino
/* * Kinderwagen mit E-Antrieb * Version 1.0 * * 17.03.2017 * * Treibt zwei DC-12V-Motoren mittels PWM an eine H-Brücke 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
in „Joystickauswertung via Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Luxsensor_TSL2591_ESP.ino
/* TSL2591 Digital Light Sensor */ /* Dynamic Range: 600M:1 */ /* Maximum Lux: 88K */ #include <Wire.h> #include <ESP8266WiFi.h> #include <Adafruit_Sensor.h> #include "Adafruit_TSL2591.h" #include <ESP8266HTTPClient.h> #include <Float.h> #define SERIAL // wenn aktiv: Meldungen per Serial #define MAXREFRESH 300 //max. Anzahl Schleifen bis Aktualisierung Datenbank auch bei unverändertem Wert (abhängig von delay in der Hauptschleife, normalerweise 1s) const String host = "meinserver.de"; const unsigned int port = 80; const String url_start = "/homezaehler/middleware.php/data/"; const String url_stop = "
in „Lux-Sensor Adafruit TSL2591 und ESP8266“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
lLinpackBenchmark2017.ino
gist.githubusercontent.com/projectgus/8279947/raw/5746ada75a0442d14affa789fbff0f1a5ec5d52f/linpack_bench.ino # include <stdlib.h> # include <stdio.h> # include <math.h> int do_benchmark ( void ); double cpu_time ( void ); void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy ); double
in „Benchmark für Arduino-Boards?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_may24a.ino
#include <LiquidCrystal.h> LiquidCrystal lcd(12,11,8,4,7,2); const int tempsenso=A0; int temp; const int motor=6; int endwert; float Wert1; const int LED=3; const int LED2=5; const int LED1=9; float TempDisplay; void setup() { pinMode(tempsenso,INPUT); //misst temperatur (bekommt Signal) Serial.begin(9600); pinMode(motor, OUTPUT); //dreht sich (gibt Signal) pinMode(LED, OUTPUT); //LED aus pinMode(LED1, OUTPUT); // leuchtet blau (gibt Signal) pinMode(LED2, OUTPUT); //LED aus lcd.begin(16,2); //16,2 ist die Bezeichnung der Zeilen und Spalten (16=Spalten, 2=Zeilen) lcd.setCursor(0,0); //bestimmt die
in „Arduino, LCD und PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_jun10a.ino
#define __AVR_ATmega2560__ //#include <avr/io.h> #include <avr/iomxx0_1.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> //definiert den Datentyp uint8_t #include <avr/wdt.h> /////////////////////////////////////////////////////////////// // // Sonstige Variablen // #ifndef TRUE #define TRUE 1 #define FALSE 0 #endif double FREQ = 20000; int LEVEL = 50; // 0 - 100 % /////////////////////////////////////////////////////////////// // // UART Variablen // #ifndef TRUE #define F_CPU 16000000UL #endif #define BAUD 115200UL ///////////////////////////////////////////////////////////////
in „Arduino IO-File Problem“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Programm_Arduino_Rev3.ino
#include <math.h> const int Var1 = 4; //Anzahl der Messdurchläufe const int Fenstergroesse = 4; int Messeingang = 0; //Messung am AnalogEingang A0 deklariert int VoltArray[Var1]; //Abspeichern der Messwerte in Array int i = 0; int Pin1 = 2; int Pin2 =3; int Pin3 =4; int Pin4 =5; bool erlaubeschalten= false; //-------------------------------------------------------------------------------------------------------------------- int sum = 0; //Summe der Anzahl Messwerte float MW = 0; //Der Mittelwert in Fließkommzahlen float Volt = 0; //Hier wird auf 5 V gerechent, und auch zur MW-Bildung verwendet
in „Attiny 167(Digispark Pro) USB Verbindung unterbricht nach Programmupload“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ootsidebox3DPad050315.ino
//*********************************************************************************/ // // Elektor Labs - OOTSIDEBOX project // // Touchless - Gesture 3D-pad // // JN Lefebvre 5 Mars 2015 // https://twitter.com/Ootsidebox // https://www.facebook.com/3D.Pad // This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/. //*********************************************************************************/ #include <SPI.h> #include <EEPROM.h> //***********
in „Roboterarm mit Gestensteuerung HILFE I2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_3DMasterRev01.ino
//*********************************************************************************/ // // Elektor Labs - OOTSIDEBOX project // // Touchless - Gesture 3D-pad // // JN Lefebvre 5 Mars 2015 // https://twitter.com/Ootsidebox // https://www.facebook.com/3D.Pad // This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/. //*********************************************************************************/ #include <SPI.h> #include <EEPROM.h> #include <Wire.h
in „Roboterarm mit Gestensteuerung HILFE I2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm_1kHz.ino
void setup() { // set all PWM pins to output! // timer 1 pinMode(11, OUTPUT); // OCR1A pinMode(12, OUTPUT); // OCR1B pinMode(13, OUTPUT); // OCR1C // timer 3 pinMode(5, OUTPUT); // OCR3A pinMode(2, OUTPUT); // OCR3B pinMode(3, OUTPUT); // OCR3C // timer 4 pinMode(6, OUTPUT); // OCR4A pinMode(7, OUTPUT); // OCR4B pinMode(8, OUTPUT); // OCR4C // timer 5 pinMode(46, OUTPUT); // OCR5A pinMode(45, OUTPUT); // OCR5B pinMode(44, OUTPUT); // OCR5C // manual setup for 16 bit timer 1 with flexible PWM frequency // OCR1A/B/C inverting mode, timer mode 10, phase correct PWM, TOP set by ICR1 TCCR1A = (1<<COM1A1
in „Arduino Mega 11 PWM-Pins mit 1kHz“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
minimumSSD1306_potentiometer.ino
#include "SSD1306_minimal.h" #include <TinyWireM.h> SSD1306_Mini oled; void setup(){ oled.init(0x3c); oled.clear(); } void loop(){ // Read Potentiometer char sensorValue = analogRead(3); //Print Hello World oled.startScreen(); oled.cursorTo(15,1); oled.printString( "Hello World"); //Print Potentiometer Value oled.cursorTo(15,19); oled.printChar(sensorValue); delay(500); }
in „Attiny85 dht22 oled ssd1306 i2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
minimumSSD1306_potentiometer.ino
#include "SSD1306_minimal.h" #include <TinyWireM.h> SSD1306_Mini oled; char str[5]; void setup(){ oled.init(0x3c); oled.clear(); } void loop(){ // Read Potentiometer int sensorValue = analogRead(3); //Print Hello World oled.startScreen(); oled.cursorTo(15,1); oled.printString( "Hello World"); //Print Potentiometer Value oled.cursorTo(15,19); oled.printString( itoa(sensorValue, str, 10)); delay(500); }
in „Attiny85 dht22 oled ssd1306 i2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Thermoelement_max31855_only.ino
#include <Wire.h> #include <SPI.h> #include <Adafruit_MAX31855.h> #include <LiquidCrystal.h> //von Bibliothe importieren für LCD /**********************************************************/ LiquidCrystal lcd(8,9,10,11,12,13); // Pinbelegung vom LCD #define MAXDO 3 // Definierte Pins für MAX31855 #define MAXCSA 4 // Definierte Pins für MAX31855, Thermoelement A #define MAXCSB 6 // Definierte Pins für MAX31855, Thermoelement B #define MAXCLK 5 // Definierte Pins für MAX31855 Adafruit_MAX31855 thermocoupleA(MAXCLK, MAXCSA, MAXDO); // Definierte Pins für MAX31855, Thermoelement A Adafruit_MAX31855 thermocoupleB
in „Aruino UNO, mehrere Teilnahmer an SPI Bus“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
oneWire_addressFinder.ino
// // oneWire_addressFinder // // This sketch looks for 1-wire devices and // prints their addresses (serial number) to // the UART, in a format that is useful in Arduino sketches // Tutorial: // http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html #include <OneWire.h> OneWire ds(10); // Connect your 1-wire device to pin 10 void setup(void) { Serial.begin(9600); discoverOneWireDevices(); } void discoverOneWireDevices(void) { byte i; byte present = 0; byte data[12]; byte addr[8]; Serial.print("\n\nLooking for 1-Wire devices...\r"); while(ds.search(addr)) { Serial.print("\n\n\
in „Arduino DS18S20 geziehlt auslesen!“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_jan07bx.ino
// // http://www.mikrocontroller.net/topic/386253#new // sketch_jan07bx // ==================================================== // int tranckZahl = 6 ; // Anzahl der Getraencke #define tranckZahl 6 // include the library code: #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // === Global === int pushRIGHT = 0 ; // =1= RIGHT wurde gedruckt int pushUP = 0 ; // =1= UP wurde gedruckt int pushDOWN = 0 ; // =1= DOWN wurde gedruckt int pushLEFT = 0 ; // =1= LEFT wurde gedruckt int pushSELECT = 0 ; // =1= SELECT wurde gedruckt
in „Display Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
attiny84_24ghz.ino
/* AVR standard libs */ #include <avr/wdt.h> #include <avr/power.h> #include <avr/sleep.h> #include <avr/io.h> /* C standard Libs */ #include <stdint.h> /* Projekt Libs */ #include <SPI.h> #include <nRF24L01.h> #include <DHT.h> #include <printf.h> #include <RF24.h> #include <RF24_config.h> #include <DallasTemperature.h> #include <OneWire.h> #define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321 #define DHTPIN 2 // what digital pin we're connected to #define CE_PIN 8 // CE NRF24L01 #define CSN_PIN 7 // CSN NRF24L01 #define RF_CHANNEL 80 /* ACK Datensatz */ struct { uint8_t feuchte_enable, // 1 = Sende
in „[STM32F4xx] NRF24L01+ Funkmodul Source Code“ · Projekte & Code ·
-
Datei
SPI_Interrupt_v2.ino
)/* SPI-Kommunikation mit Interrupt und UDP Übertragung Stand: 24.07.18 */ /**************************LIBRARIES********************************/ #include <SPI.h> /***************************PORTS***********************************/ int CS=5; // CS at GPIO5 int interruptPin=4; // INT1 at GPIO4 /******************************************************************* *****************ADXL345 Register Addresses************************* ********************************************************************/ #define DEVID 0x00 //Device ID Register #define THRESH_TAP 0x1D //Tap Threshold #define OFSX 0x1E
in „ADXL345 und ESP8266: Echtzeitdatenergassung mit konstanter Abtastrate und Interrupts“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
SPI_Interrupt_UDP_Beta.ino
/* SPI-Kommunikation mit Interrupt und UDP Übertragung Stand: 24.07.18 */ /**************************LIBRARIES********************************/ #include <SPI.h> #include <ESP8266WiFi.h> #include <WiFiUdp.h> #include "Arduino.h" /***************************PORTS***********************************/ int CS=5; // CS at GPIO5 int interruptPin=4; // INT1 at GPIO4 /******************************************************************* *****************ADXL345 Register Addresses************************* ********************************************************************/ #define DEVID 0x00 //Device ID Register
in „ADXL345 und ESP8266: Echtzeitdatenergassung mit konstanter Abtastrate und Interrupts“ · Mikrocontroller und Digitale Elektronik ·