-
Datei
tictest2.ino
void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(2, INPUT); digitalWrite(2, HIGH); pinMode(3, OUTPUT); digitalWrite(3, LOW); pinMode(4, OUTPUT); digitalWrite(4, LOW); attachInterrupt(digitalPinToInterrupt(2),pickup,FALLING); } void loop() { // put your main code here, to run repeatedly: Serial.println("Starting charging..."); digitalWrite(4, HIGH); delay(2000); Serial.println("Stopping chargin..."); digitalWrite(4, LOW); delay(100); Serial.println("Discharging..."); digitalWrite(3, HIGH); delay(200); digitalWrite(3, LOW); Serial.println("Done!"); delay(3000
in „Kondensator mit Optokoppler auf 400V laden“ · Analoge Elektronik und Schaltungstechnik ·
-
Datei
tssp4038.ino
/* 38 kHz pulse driver for IR transmitter */ #define PULSEOUT 12 // OCR1B, must be an OCRxy pin #define PULSE 80 #define PERIOD 420 #define PULSE_ON TCCR1A = 0b00100010; #define PULSE_OFF TCCR1A = 0b00000010; void setup() { pinMode(PULSEOUT, OUTPUT); /* manual timer 1 setup for OC1B timer mode 14, fast PWM, ICP = TOP prescaler 1 */ TCCR1A = 0b00000010; TCCR1B = 0b00011001; OCR1B = PULSE; ICR1 = PERIOD; PULSE_ON } void loop() { PULSE_ON _delay_ms(500); PULSE_OFF _delay_ms(500); }
in „Infrarot LED Lichtschranke“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Test_formatiert.ino
int altpos1; int neupos1; int altpos2; int neupos2; int pos1 = 11; int pos2 = 10; int positionsmotor; int anders1; int anders2; void setup() { // put your setup code here, to run once: pinMode(pos1, INPUT_PULLUP); pinMode(pos2, INPUT_PULLUP); Serial.begin(9600); altpos1 = digitalRead(pos1); anders1 = 1; altpos2 = digitalRead(pos2); anders2 = 1; } void loop() { // put your main code here, to run repeatedly: neupos1 = digitalRead(pos1); if (neupos1 > altpos1 & anders1 == 0) { positionsmotor = 1; altpos1 = neupos1; anders1 = 1; Serial.println(positionsmotor); Serial.println(); } else { if (neupos1
in „Flankenauswertung für 2 Eingänge“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Hauptcode_mit_Testcode.ino
// Einbinden der Bibliotheken //**************************************************************************************************************************************************************** #include <SIM900.h> #include <SoftwareSerial.h> #include <GSM.h> #include <call.h> //**************************************************************************************************************************************************************** //Festlegen der Variablen //*************************************************************************************************************************************
in „Arduino Uno : "Selstsames" Verhalten von 2 Codes“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
LSC_Tuerkontakt.ino
#define OTA // nach langem Tastendruch OTA update möglich //#define WIFIAP // nach langem Tastendruch WIFI Netz über AP 192.168.4.1 suchen eingeben //#define DEBUG // wenn nicht auskommentiert, Debugausgabe auf Softwareseriell RX GPIO4 TX GPIO5 int httpPort = 8083; //Fhem Daten byte host[] = { 192, 168, 178, 53 }; #include <SoftwareSerial.h> #include <ESP8266WiFi.h> #include <ESP8266mDNS.h> #include <WiFiUdp.h> #include <ArduinoOTA.h> #include <WiFiManager.h> byte IC_com(); //Ergebniss der Comm zwischen MCU und ESP String IPName =""; //Fhem device = IPnummer byte SWstatus = 0; //für Softserial
in „LSC Smart Connect - neues Smart Home System bei Action“ · Haus & Smart Home ·
-
Datei
pRUEBA.ino
//The timer can either run from 0 to 255, or from 0 to a fixed value. (The 16-bit Timer 1 has additional modes to supports timer values up to 16 bits.) //In the following "x" is "0", "1" or "2" for timer 0, 1 or 2. // //Setting the timer prescaller: // Setting Prescale_factor // TCCRxB = _BV(CS01); 1 // TCCRxB = _BV(CS11); 8 // TCCRxB = _BV(CS10) | _BV(CS11); 64 // TCCRxB = _BV(CS12); 256 // TCCRxB = _BV(CS10) | _BV(CS12); 1024 // //WGM bits: // Control the overall mode of the timer (These bits are split between TCCRnA and TCCRnB registers) // //CS bits // Clock Select bits, these control the
in „PWM Singnalen mit Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
code.ino.txt
#include <VirtualWire.h> #include <Conceptinetics.h> #define DMX_SLAVE_CHANNELS 5 DMX_Slave dmx_slave ( DMX_SLAVE_CHANNELS ); const int ledPin = 13; //**************************Zuweisung 230V Ausgänge und Statusanzeige Funkkanäle************************************** const int CH1 = 30; const int CH2 = 31; const int CH3 = 32; const int CH4 = 33; const int CH5 = 34; const int CH6 = 35; const int CH7 = 36; const int CH8 = 37; //*****************************Zuweisung DIP Schalter für Addressierung*********************************************** const int S1 = 11; const int S2 = 22; const int S3 = 23
in „DMX Auswertung mit Arduino geht nicht“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
max31865.ino
/******************************************************************************* * Copyright (C) 2014 Benedikt Schlagberger * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice
in „MAX31865 + PT100 kommuniziert nicht mit Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DHT_LCD.ino
#include "DHT.h" #include <rgb_lcd.h> #include "Wire.h" #include <SPI.h> // DHT Sensor Setup #define DHTPIN 2 // what pin we're connected to #define DHTTYPE DHT22 // DHT 22 (AM2302) int kuehlschrank = 5; int luftbefeuchter = 4; int luefter = 3; float temp = 1.3; //1.2aus //1.4an float humidity = 50.0; float t; float h; long previousMillis = 0; long interval = 2000; // LCD Setup rgb_lcd lcd; const int colorR = 0; const int colorG = 0; const int colorB = 255; // DHT Setup DHT dht(DHTPIN, DHTTYPE); void setup() { Serial.begin(9600); // set LCD lcd.begin(16, 2); lcd.setRGB(colorR, colorG, colorB);
in „Arduino friert ein nach 1-3h“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Roboter_mit_Kompass.ino
#include <Wire.h> #include <LSM303.h> LSM303 compass; #include <Wire.h> // binde Bibliothek Wire.h ein #include <LSM303.h> // binde Bibliothek LSM303 ein #include <LiquidCrystal.h> // binde Bibliothek LCD ein int geschwindigkeitLinks = 0; int geschwindigkeitRechts = 0; int iR = 0; int iL = 0; const int Richtung = 50; // Richtung Ziel in Grad, nur ein Beispiel /*-----( Import needed libraries )-----*/ LiquidCrystal lcd(8, 9, 4, 5, 6, 7); int E1 = 3; // 6 oder 10 int M1 = 12; // 7 int E2 = 11; // 5 int M2 = 13; // 4 void nonstop () // 0 bis 255 , von langsam bis vollgas { digitalWrite(M1,HIGH);
in „Kompass-Motorsteuerung mit einem Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Elektronisches_Zahlenschloss.ino
#include <Keypad.h> char* secretCode = "123456"; int position = 0; const byte rows = 4; const byte cols = 3; char keys[rows][cols] = { {'1','2','3'}, {'4','5','6'}, {'7','8','9'}, {'*','0','#'} }; byte rowPins[rows] = {4, 5, 6, 7}; byte colPins[cols] = {1, 2, 3}; Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols); int redPin = 8; int greenPin = 9; int relais = 10; void setup() { pinMode(redPin, OUTPUT); pinMode(greenPin, OUTPUT); pinMode(relais, OUTPUT); setLocked(true); } void loop() { char key = keypad.getKey(); if (key == '*' || key == '#') { position = 0; setLocked(true);
in „Elektr. Zahlenschloss mit Adrduino Belegung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
rs232.ino
char zeichen[100]; byte bit8; int i,a = 0; int start = 0; void setup(){ pinMode(4, INPUT); Serial.begin(115200); } void loop(){ a = 0; while(bit8 != 3){ bit8 = 0; start=digitalRead(4); while (start == 1){start=digitalRead(4);} for (i=0;i<10; i++) { if((i < 9) && (i != 0)){ bit8 = bit8 >> 1; bit8 = bit8 + 128 * digitalRead(4); Serial.print(digitalRead(4)); } delayMicroseconds(1000000/75); } zeichen[a]=bit8; Serial.print(zeichen[a]); Serial.println(bit8); a++; } }
in „Probleme mit fgets() und write() - RS232“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
fotoled_seriell.ino
// Pin 14 has an LED with a resistor connected int led = A1; int val = 0; // Val for the Analogread String buffer = ""; // Serial Input-Buffer; void setup() { pinMode(led, OUTPUT); Serial.begin(9600); } void loop() { } void serialEvent() { char ch = (char)Serial.read(); buffer += ch; if (ch == 13) { // 13 == CR - string finish evalSerialData(); } } void evalSerialData() { if (buffer[0] == '1') { digitalWrite(led, HIGH); } if (buffer[0] == '2') { digitalWrite(led, LOW); } if (buffer[0] == '3') { digitalWrite(led, LOW); delay(5); pinMode(led, INPUT); delay(5); val = analogRead(led); float voltage
in „LED zur Helligkeitsmessung - ADC Spannungsmessung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sekundenzeiger_mit_Stepper.ino
/* This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2 It won't work with v1.x motor shields! Only for the v2's with built in PWM control For use with the Adafruit Motor Shield v2 ----> http://www.adafruit.com/products/1438 */ // include the library code: #include <Wire.h> #include <Adafruit_MotorShield.h> #include <LiquidCrystal.h> #include "utility/Adafruit_PWMServoDriver.h" LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //include variables volatile boolean secondPassed; volatile boolean minutePassed; volatile byte seconds; volatile unsigned int minutes; // Create the motor
in „Arduino Stepper Sekundenzeiger“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
fotoled_seriell.ino
// Pin 14 has an LED with a resistor connected int led = A1; int val = 0; // Val for the Analogread int val2 = 0; // Val for the Analogread int val3 = 0; // Val for the Analogread int val4 = 0; // Val for the Analogread String buffer = ""; // Serial Input-Buffer; void setup() { pinMode(led, OUTPUT); Serial.begin(9600); } void loop() { } void serialEvent() { char ch = (char)Serial.read(); buffer += ch; if (ch == 13) { // 13 == CR - string finish evalSerialData(); } } void evalSerialData() { if (buffer[0] == '1') { digitalWrite(led, HIGH); } if (buffer[0] == '2') { digitalWrite(led, LOW); } if (
in „LED zur Helligkeitsmessung - ADC Spannungsmessung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
sketch_2.ino
const int ls1pin = 1; // Lichtschranke 1 ist auf Pin 1 const int ls2pin = 2; // Lichtschranke 2 ist auf Pin 2 int counter = 4; // Zählerfunktion int summer = 3; // Summer ist auf Pin 3 int LS1; int LS2; boolean Merker1 = 0; // Merker für Lichtschranke 1 boolean Merker2 = 0; // Merker für Lichtschranke 2 void setup(){ // Setzt Ein- und Ausgänge, unveränderlich pinMode(ls1pin, INPUT); // Lichrschranke 1 ist ein Eingang pinMode(ls2pin, INPUT); // Lichtschranke 2 ist ein Eingang pinMode(summer, OUTPUT); // Summer ist ein Ausgang } void loop() { for (counter=0; counter<10;) // Setzbedingung Counter {
in „Arduino Programm funktioniert nicht“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sketch5.ino
/* Basic Grafix.ino * * Created: 9/20/2014 5:09:28 PM * Author: BasisV12 */ //Bus Pins (Arduino digital Pin numbers) #define LCD_D0_PIN 8 #define LCD_D1_PIN 9 #define LCD_D2_PIN 2 #define LCD_D3_PIN 3 #define LCD_D4_PIN
in „2.4" Display-Shield (SPFD5408) an Aduino DUE“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Sketch9.ino
/* Basic Grafix.ino * * Created: 9/20/2014 5:09:28 PM * Author: BasisV12 */ //Bus Pins (Arduino digital Pin numbers) #define LCD_D0_PIN 8 #define LCD_D1_PIN 9 #define LCD_D2_PIN 2 #define LCD_D3_PIN 3 #define LCD_D4_PIN
in „2.4" Display-Shield (SPFD5408) an Aduino DUE“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
TNARX_simple.ino
int cs = 3; int clock = 4; int data = 5; byte bild[112] ={0,0,0,0,1,0,0,0, //1. Stelle (ganz rechts) RechtsUnten,x,Unten,RechtsOben,Mitte,Oben,LinksUnten,LinksOben //x=nicht belegt/keine Auswirkung 0,0,0,0,1,0,0,0, //2. Stelle: 0 (als Beispiel) 0,0,0,0,1,0,0,0, //3. Stelle: 1 0,0,0,0,1,0,0,0, //4. Stelle: 2 0,0,0,0,1,0,0,0, //5. Stelle: 3 0,0,0,0,1,0,0,0, //6. Stelle: 4 1,1,0,0,1, // Glocke,Schrägstich,MEM,CHAN,x 1,0,0, // 1(DP),0(DQ),0(DR) - 1/2 duty, obere Segmente D54-D112 folgen) //hier beginnt die obere Hälfte 1,0,1,0,1,1,0,1, //7. Stelle: 5 1,0,1,0,1,1,1,1, //8. Stelle: 6 1,0,0,1,0,1,0,0, //9
in „Dokumentation gesucht (UC121902-TNARX-A)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DecoderBeispiel.ino
#define Switch0pin 2 //corresponds to PCINT18; EncBitA #define Switch1pin 3 //corresponds to PCINT19; EncBitB #define Switch2pin 4 //corresponds to PCINT20; Puschbutton //This defines are two convenient 'function macros' that allow the setting or clearing of individual bits in a register. #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) //cleare bit in byte at sfr adress #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) //set bit in byte at sfr adress //Global variables byte ErrorFlag = -1; byte Modus = 0; long SensorWert = 0; long SensorWert80 = 140; long SensorWert180 = 810; long SensorSteigung
in „Drehimpulsgeber Rastung Bascom, welcher ist der richtige Typ?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Accelometer__nderung.ino
#include <Wire.h> #include <stdio.h> #include <stdint.h> #include <unistd.h> #include <I2Cdev.h> #define GYRO 0x68 // gyro I2C address #define REG_GYRO_X 0x1D // IMU-3000 Register address for GYRO_XOUT_H #define AUX_DMP_CONTROLL 0x3D // IMU-3000 Register address for controling digital motion processor and the aux device // GYRO Register #define GYRO_XOUT_H 0x1D #define GYRO_XOUT_L 0x1E #define GYRO_YOUT_H 0x1F #define GYRO_YOUT_L 0x20 #define GYRO_ZOUT_H 0x21 #define GYRO_ZOUT_L 0x22 char SMPLRT_DIV = 0x15; char DLPF_FS = 0x16; // ACCEL Register #define ACCEL 0x0F // Accel I2C Address #define KXTF9
in „Arduino Gyroscope und Accelometer Werte schwanken“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Forum1.ino
#include <sainsmartkeypad.h> /* Digital Light Wand + SD + LCD + Arduino MEGA - V MRR-3.0 (WS2812 RGB LED Light Strip) by Michael Ross 2014 Based on original code by myself in 2010 then enhanced by Is0-Mick in 2012 The Digital Light Wand is for use in specialized Light Painting Photography Applications. This code is totally rewritten using code that IsO-Mick created made to specifically support the WS2812 RGB LED strips running with an SD Card, an LCD Display, and the Arduino Mega 2560 Microprocessor board. The functionality that is included in this code is as follows: Menu System 1 - File select
in „arduino display geht aus“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Fertig_ohne_Comments.ino
#include <SoftwareSerial.h> //SoftwareSerial Library #include <avr/sleep.h> //Sleep Modus Library SoftwareSerial SIM900(7, 8); // Konfiguriert die Software Schnittstelle zwischen den Boards int counter=0; // Counter wird initialisiert //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void setup(){ Serial.begin(9600); SIM900.begin(19200); SIM900power(); // GSM Shield wird eingeschaltet delay(2000); //configure pin3 as an input and enable the internal pull-up resistor pinMode(3, INPUT_PULLUP); pinMode(13, OUTPUT); //LED13 pinMode
in „Projekt Türüberwachung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
BootLoader.ino
#include "test.h" #include <SPI.h> // RAM Datalines int d0 = A0; int d1 = A1; int d2 = A2; int d3 = A3; int d4 = A4; int d5 = A5; int d6 = 6; int d7 = 7; // RAM Control int cs_ram = 4; int we_ram = 3; int oe_ram = 2; // RAM Addresslines int miso = 11; int mosi = 12; int sck = 13; int oe_sr = 10; int ce1_sr = 8; int ce2_sr = 9; // MPU Control int reset = 5; void vSetReset(bool active) { digitalWrite(reset, !active); } void vSetChipSelectRam(bool select) { digitalWrite(cs_ram, !select); } void vSetWriteRam(bool active) { digitalWrite(we_ram, !active); } void vSetReadRam(bool active) { digitalWrite
in „Externen SRAM benutzen SPI/Parallel?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pt1000.ino
/* Beispielprogramm fuer einfache PT1000-Messung mit einem Arduino Uno (ATmega328). 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 AREF des Arduino-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 UART aus (Serial-Monitor
in „PT1000, einfache Auswertung mit AVR (ATmega328)“ · Projekte & Code ·
-
Datei
KTY_Temperatur.ino
/* Beispielprogramm fuer einfache Temperaturmessung KTY-Sensor (KTY81/110) mit einem Arduino Uno (ATmega328). Zunächst die Schaltungsbeschreibung: Der zu messende KTY-Sensor (1000 Ohm @ 25°C) liegt mit einem Ende an GND und mit dem anderen Anschluss am Eingang A0 (ADC.0). PortB.0 des Arduino-Boards dient als geschalteter Ausgang für die Referenzspannung und geht zum einen an den Anschluss AREF und zum anderen ueber einen Widerstand KTY_REF 1000 Ohm 0,1% an den Eingang A0. Der KTY_1000 und der 1000 Ohm Widerstand bilden somit einen Spannungsteiler, der bei 25 Grad C die Spannung an AREF genau 1
in „Temperatursensor KTY81 am ATmega328 (Arduino UNO), 1-6 Kanäle“ · Projekte & Code ·
-
Datei
Sender_mit_DHT.ino
// library #include <VirtualWire.h> #include <DHT.h> #define DHTPIN 9 #define DHTTYPE DHT22 //DHT11, DHT21, DHT22 DHT dht(9, DHT22); void setup() { Serial.begin(9600); // virtual wire vw_set_tx_pin(12); // pin vw_setup(8000); // bps } void loop() { float h = dht.readHumidity(); //Luftfeuchte auslesen float t = dht.readTemperature(); //Temperatur auslesen sendString("t", true); delay(100); } void sendString(String message, bool wait) { byte messageLength = message.length() + 1; // convert string to char array char charBuffer[messageLength]; message.toCharArray(charBuffer, messageLength); vw_send
in „Arduino 433Mhz Modul mit Temperatur Sensor“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Servo_temperatur.ino
#include <Wire.h> #include <Servo.h> Servo servo1; #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x3F,20,4); // set the LCD address to 0x3F for a 16 chars and 4 line display void setup() { #define HYT_ADDR 0x28 // I2C address of the HYT 221, 271, 371 and most likely the rest of the family Wire.begin(); // Join I2c Bus as master pinMode(13, OUTPUT); // Set pin 13 to output for status LED // I2C Pins on the Arduino Uno are A4 for SDA and A5 for SCL Serial.begin(9600); // Start serial communication for serial console output lcd.init(); lcd.backlight(); float val3; val3 = 50; servo1.attach(33); servo1
in „Variable Temperaturabhängig ändern Arduino.“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_3strip.ino
#include <Adafruit_NeoPixel.h> #include <avr/io.h> #include <avr/interrupt.h> #define NUMPIXELSA 5 #define NUMPIXELSB 5 #define NUMPIXELSC 5 Adafruit_NeoPixel strip_A = Adafruit_NeoPixel(NUMPIXELSA, 0, NEO_GRB + NEO_KHZ800); // 3 Strips designed to be offset by 120 degrees on a wheel Adafruit_NeoPixel strip_B = Adafruit_NeoPixel(NUMPIXELSB, 1, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel strip_C = Adafruit_NeoPixel(NUMPIXELSC, 3, NEO_GRB + NEO_KHZ800); //uint32_t whiteA = strip_A.Color(255, 255, 255); disabled for testing purposes //uint32_t whiteB = strip_B.Color(255, 255, 255); //uint32_t whiteC =
in „Interrupt in C / ATTiny / WS 2812B“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_3strip.ino
#include <Adafruit_NeoPixel.h> #include <avr/io.h> #include <avr/interrupt.h> //Lenght of Pixel strips #define NUMPIXELSA 5 #define NUMPIXELSB 5 #define NUMPIXELSC 5 // 3 Strips designed to be offset by 120 degrees on a wheel Adafruit_NeoPixel strip_A = Adafruit_NeoPixel(NUMPIXELSA, 0, NEO_GRB + NEO_KHZ800); // PB0 Adafruit_NeoPixel strip_B = Adafruit_NeoPixel(NUMPIXELSB, 1, NEO_GRB + NEO_KHZ800); // PB1 Adafruit_NeoPixel strip_C = Adafruit_NeoPixel(NUMPIXELSC, 3, NEO_GRB + NEO_KHZ800); // PB3 //uint32_t whiteA = strip_A.Color(255, 255, 255); disabled for testing purposes //uint32_t whiteB = strip_B.Color
in „Interrupt in C / ATTiny / WS 2812B“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
luefter_001.ino
int boardled = 13; int basis = 12; int steuer; unsigned long previousMillis = 0; unsigned long zeita = 50; // Luefter an in Millisekunden unsigned long zeitb = 50; // Luefter aus in Millisekunden unsigned long interval; void setup() { pinMode(boardled, OUTPUT); pinMode(basis, OUTPUT); } void loop() { unsigned long currentMillis = millis(); if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; if (steuer == LOW) { steuer = HIGH; interval = zeita; } else { steuer = LOW; interval = zeitb; } // set the LED with the ledState of the variable: digitalWrite(boardled, steuer
in „Arduino Lüfterdrehzahlsteuerung mit niederfrequenter PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_3strip.ino
#include <Adafruit_NeoPixel.h> #include <avr/io.h> #include <avr/interrupt.h> #define NUMPIXELSA 5 #define NUMPIXELSB 5 #define NUMPIXELSC 5 Adafruit_NeoPixel strip_A = Adafruit_NeoPixel(NUMPIXELSA, 0, NEO_GRB + NEO_KHZ800); // 3 Strips designed to be offset by 120 degrees on a wheel Adafruit_NeoPixel strip_B = Adafruit_NeoPixel(NUMPIXELSB, 1, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel strip_C = Adafruit_NeoPixel(NUMPIXELSC, 3, NEO_GRB + NEO_KHZ800); //uint32_t whiteA = strip_A.Color(255, 255, 255); disabled for testing purposes //uint32_t whiteB = strip_B.Color(255, 255, 255); //uint32_t whiteC =
in „Interrupt in C / ATTiny / WS 2812B“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
luefter_002.ino
int boardled = 13; int basis = 12; int poti = A0; int steuer; int previousMillis = 0; int zeita; int zeitp; int interval; void setup() { pinMode(boardled, OUTPUT); pinMode(basis, OUTPUT); } void loop() { int currentMillis = millis(); zeitp = analogRead(poti); // 0...1023 zeitp = 1023 - zeitp; // umkehr der Potidrehrichtung zeitp /= 4; // 0...255 zeita = 355 - zeitp; // soll mindestens 100msec sein if (currentMillis - previousMillis >= interval) { previousMillis = currentMillis; if (steuer == LOW) { steuer = HIGH; interval = zeita; } else { steuer = LOW; interval = zeitp; } digitalWrite(boardled,
in „Arduino Lüfterdrehzahlsteuerung mit niederfrequenter PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
collectorspannung_001.ino
int boardled = 13; int gruen = 11; int basis = 12; boolean steuer; int start; int ist; int zeita = 500; int zeitb = 500; int interval; boolean verz; boolean mess; // HIGH, Messung der Collectorspannung boolean steuervz; // HIGH, Schalttransistor wird angesteuert int startausvz; int istausvz; void setup() { pinMode(boardled, OUTPUT); pinMode(basis, OUTPUT); pinMode(gruen, OUTPUT); } void loop() { ist = millis(); if (ist - start > interval) { start = ist; if (steuer == LOW) { steuer = HIGH; interval = zeita; } else { steuer = LOW; interval = zeitb; } } if (ist - start > 200) // t1 bis t2 MF { verz
in „Arduino Lüfterdrehzahlsteuerung mit niederfrequenter PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
luefter_003.ino
int boardled = 13; int basis = 12; int poti = A0; int collectorspannung = A1; boolean steuer, verz, mess, steuervz, collector, kurzschluss; int start, ist; // für MF_t1t2, MV_t1t3t1 int zeita, zeitp, interval, spannung; int startausvz, istausvz; // für MF_t3t4 void setup() { pinMode(boardled, OUTPUT); pinMode(basis, OUTPUT); } void loop() { ist = millis(); zeitp = analogRead(poti); // 0...1023 zeitp = 1023 - zeitp; // umkehr der Potidrehrichtung zeitp /= 4; // 0...255 zeita = 345 - zeitp; // MF_t1t3 soll mindestens 90msec sein if (ist - start > interval) // MV_t1t3t4, MF_t1t2 triggert { start
in „Arduino Lüfterdrehzahlsteuerung mit niederfrequenter PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DisplayString.ino
// IMPORTANT: ELEGOO_TFTLCD LIBRARY MUST BE SPECIFICALLY // CONFIGURED FOR EITHER THE TFT SHIELD OR THE BREAKOUT BOARD. // SEE RELEVANT COMMENTS IN Elegoo_TFTLCD.h FOR SETUP. //Technical support:goodtft@163.com #include <Elegoo_GFX.h> // Core graphics library #include <Elegoo_TFTLCD.h> // Hardware-specific library // The control pins for the LCD can be assigned to any digital or // analog pins...but we'll use the analog pins as this allows us to // double up the pins with the touch screen (see the TFT paint example). #define LCD_CS A3 // Chip Select goes to Analog 3 #define LCD_CD A2 // Command/Data
in „2.8 TFT von egeloo“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_9341uno.ino
//Technical support:goodtft@163.com // Breakout/Arduino UNO pin usage: // LCD Data Bit : 7 6 5 4 3 2 1 0 // Uno dig. pin : 7 6 5 4 3 2 9 8 // Uno port/pin : PD7 PD6 PD5 PD4 PD3 PD2 PB1 PB0 // Mega dig. pin: 29 28 27 26 25 24 23 22 #define LCD_RD A0 #define LCD_WR A1 #define LCD_RS A2 #define LCD_CS A3 #define LCD_REST A4 void Lcd_Writ_Bus(unsigned char d) { PORTD = (PORTD & B00000011) | ((d) & B11111100); PORTB = (PORTB & B11111100) | ((d) & B00000011); *(portOutputRegister(digitalPinToPort(LCD_WR))) &= ~digitalPinToBitMask(LCD_WR); *(portOutputRegister(digitalPinToPort(LCD_WR)))|= digitalPinToBitMask
in „2.8 TFT von egeloo“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
OLED_Test.ino
#include "SPI.h" #define CS 10 #define DC 9 #define RST 8 void setup() { uint8_t row,col; pinMode(CS, OUTPUT); digitalWrite(CS, HIGH); pinMode(DC, OUTPUT); pinMode(RST, OUTPUT); digitalWrite(RST, LOW); delayMicroseconds(12); // > 10µs digitalWrite(RST, HIGH); delayMicroseconds(4); // > 2µs SPI.begin(); SPI.setBitOrder(MSBFIRST); // Init digitalWrite(CS, LOW); // clear internal RAM of SH1106 for(row=0;row<8;row++) { digitalWrite(DC, LOW); // write commands SPI.transfer(0xb0 + row); // set page address SPI.transfer(0x00); // set lower column address to 0 SPI.transfer(0x10); // set higher column
in „SH1106 Init-Sequenz“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
OLED_Test.ino
#include "SPI.h" #define CS 10 #define DC 9 #define RST 8 void setup() { uint8_t row,col; pinMode(CS, OUTPUT); digitalWrite(CS, HIGH); pinMode(DC, OUTPUT); pinMode(RST, OUTPUT); digitalWrite(RST, LOW); delayMicroseconds(12); // > 10µs digitalWrite(RST, HIGH); delayMicroseconds(4); // > 2µs SPI.begin(); SPI.setBitOrder(MSBFIRST); // Init digitalWrite(CS, LOW); // without init, only default values, charge-pump setup to 8.0V // measured: 8,1V // values taken from HCuOLED library // charge-pump voltage measured: 8,1V #if 0 digitalWrite(DC, LOW); // write commands SPI.transfer(0xa8); // set mux-ratio
in „SH1106 Init-Sequenz“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
OLED_Test.ino
/* Test-Sketch for various SH1106 init sequence that can be found in the internet Rudolph Riedel 2017-07 */ #include "SPI.h" #define CS 10 #define DC 9 #define RST 8 void setup() { uint8_t row,col; pinMode(CS, OUTPUT); digitalWrite(CS, HIGH); pinMode(DC, OUTPUT); pinMode(RST, OUTPUT); digitalWrite(RST, LOW); delayMicroseconds(12); // > 10µs digitalWrite(RST, HIGH); delayMicroseconds(4); // > 2µs SPI.begin(); SPI.setBitOrder(MSBFIRST); // Init digitalWrite(CS, LOW); // without init, only default values, charge-pump setup to 8.0V // measured: 8,1V #if 0 #endif // values taken from HCuOLED library
in „SH1106 Init-Sequenz“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
arduino_mess.ino
#include <doxygen.h> #include <NexButton.h> #include <NexConfig.h> #include <NexCrop.h> #include <NexDualStateButton.h> #include <NexGauge.h> #include <NexHardware.h> #include <NexHotspot.h> #include <NexNumber.h> #include <NexObject.h> #include <NexPage.h> #include <NexPicture.h> #include <NexProgressBar.h> #include <NexSlider.h> #include <NexText.h> #include <NexTimer.h> #include <Nextion.h> #include <NexTouch.h> #include <NexUpload.h> #include <NexWaveform.h> #include <SPI.h> #include "Adafruit_MAX31855.h" #define MAXDO 3 // Definierte Pins für MAX31855 #define MAXCS2 6 #define MAXCS3 7 #define MAXCS4
in „Übertragungsgeschwindigkeit SPI Bus Arduino Mega“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
arduino_mess.ino
#include <doxygen.h> #include <NexButton.h> #include <NexConfig.h> #include <NexCrop.h> #include <NexDualStateButton.h> #include <NexGauge.h> #include <NexHardware.h> #include <NexHotspot.h> #include <NexNumber.h> #include <NexObject.h> #include <NexPage.h> #include <NexPicture.h> #include <NexProgressBar.h> #include <NexSlider.h> #include <NexText.h> #include <NexTimer.h> #include <Nextion.h> #include <NexTouch.h> #include <NexUpload.h> #include <NexWaveform.h> #include <SPI.h> #include "Adafruit_MAX31855.h" #define MAXDO 3 // Definierte Pins für MAX31855 #define MAXCS2 6 #define MAXCS3 7 #define MAXCS4
in „Übertragungsgeschwindigkeit SPI Bus Arduino Mega“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
FG_328.ino
/* Programm für ATtiny4313 Am Ausgang OC1B wird ein Impuls ausgegeben, der mit der Variablen 'W' in µs eingestellt wird. Die Periodendauer (1/Frequenz) wird mit 'P' in µs eingestellt. Die Grenzwerte werden durch die entsprechenden #define-Anweisungen vorgegeben. Die Minima per #define sind 5µs für die Pulsweite und 20 µs (50kHz) für die Periodendauer, die Maxima 10s und 100s für die Periodendauer (0,01Hz). Ferner lässt sich die Impulserzeugung per Befehl 'O' ein-/ausschalten. Als Default-Wert nach dem Einschalten sind 50Hz mit 50% Tastverhältnis vorgegeben. Die Befehle werden durch das Steuerzeichen
in „PWM-Signal mit 0,1 Hz erzeugen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Beispielw5100.ino
/* SCP1000 Barometric Pressure Sensor Display Serves the output of a Barometric Pressure Sensor as a web page. Uses the SPI library. For details on the sensor, see: http://www.sparkfun.com/commerce/product_info.php?products_id=8161 This sketch adapted from Nathan Seidle's SCP1000 example for PIC: http://www.sparkfun.com/datasheets/Sensors/SCP1000-Testing.zip Circuit: SCP1000 sensor attached to pins 6,7, and 11 - 13: DRDY: pin 6 CSB: pin 7 MOSI: pin 11 MISO: pin 12 SCK: pin 13 created 31 July 2010 by Tom Igoe */ #include <avr/pgmspace.h> #include <Ethernet.h> // the sensor communicates using SPI,
in „Arduino Nano und ENC28J60 Ethernet Shield“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
dfplayer2.ino
#include "Arduino.h" #include "SoftwareSerial.h" #include "DFRobotDFPlayerMini.h" SoftwareSerial mySoftwareSerial(10, 11); // RX, TX DFRobotDFPlayerMini myDFPlayer; void printDetail(uint8_t type, int value); void setup() { mySoftwareSerial.begin(9600); Serial.begin(115200); Serial.println(); Serial.println(F("DFRobot DFPlayer Mini Demo")); Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)")); if (!myDFPlayer.begin(mySoftwareSerial)) { //Use softwareSerial to communicate with mp3. Serial.println(F("Unable to begin:")); Serial.println(F("1.Please recheck the connection!")); Serial.println
in „Problem mit DFPlayer“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
LED_Cube.ino
/*************************************************************************************** Name : LED CUBE 8x8x8 74HC595 By : ****************************************************************************************/ #include <TimerOne.h> #include <string.h> #include <pins_arduino.h> //NEU #define AXIS_X 1 #define AXIS_Y 2 #define AXIS_Z 3 //--- Pin connected to ST_CP of 74HC595 //--- Gelbe Leitung RCK int latchPin = 10; //--- Pin connected to SH_CP of 74HC595 //--- Schwarze Leitung SCK int clockPin = 13; //--- Pin connected to DS of 74HC595 //--- Lila Leitung SI int dataPin = 11; //--- Used for faster
in „LED-Cube Effekte weiter per Knopfdruck“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Cube_Gro_.ino
/*************************************************************************************** Name : LED CUBE 8x8x8 74HC595 By : ****************************************************************************************/ #include <TimerOne.h> #include <string.h> #include <SPI.h> #define AXIS_X 1 #define AXIS_Y 2 #define AXIS_Z 3 #define BUTTON_PIN 14 #define TOTAL_EFFECTS 17 //--- Pin connected to ST_CP of 74HC595 //--- Gelbe Leitung RCK int latchPin = 10; //--- Pin connected to SH_CP of 74HC595 //--- Schwarze Leitung SCK int clockPin = 13; //--- Pin connected to DS of 74HC595 //--- Lila Leitung SI int dataPin
in „LED-Cube Effekte weiter per Knopfdruck“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Motor_2.ino
int zahl = 8; int ins = 1; void setup() { pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); Serial.begin(9600); } void loop() { if(zahl < 12 && zahl > 7 && ins < 300) { digitalWrite(zahl, HIGH); delay(5); digitalWrite(zahl, LOW); Serial.println(zahl); zahl ++; ins ++; } else if(zahl < 12 && zahl > 7 && ins > 299 && ins < 601 ) { digitalWrite(zahl, HIGH); delay(5); digitalWrite(zahl, LOW); Serial.println(zahl); zahl = zahl -1; ins ++; } if (ins > 600) { ins = 0; } if (zahl = 7){ zahl = 11; } if(zahl = 12){ zahl =8; } Serial.println(ins); }
in „Schrittmotor hin und her pendeln lassen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
TFT_Clock.ino
/* from https://github.com/Bodmer/TFT_ILI9341/tree/master/examples/TFT_Clock reworked for ARDUINO DUE using the Adafruit Libraries TFT used: ILI9340C libraries used: https://github.com/adafruit/Adafruit_ILI9340 https://github.com/adafruit/Adafruit-GFX-Library An example analogue clock using a TFT LCD screen to show the time use of some of the drawing commands with the modified Adafruit_TFT_AS library. For a more accurate clock, it would be better to use the RTClib library. But this is just a demo. This sketch uses font 4 only. Make sure all the required fonts are loaded by editting the User_Setup.h
in „2.2'TFT ILI9340 und Arduino“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
TFT_meters.ino
/* from https://github.com/Bodmer/TFT_ILI9341/blob/master/examples/TFT_Meters/TFT_Meters.ino reworked for ARDUINO DUE using the Adafruit Libraries TFT used: ILI9340C libraries used: https://github.com/adafruit/Adafruit_ILI9340 https://github.com/adafruit/Adafruit-GFX-Library Example animated
in „2.2'TFT ILI9340 und Arduino“ · Mikrocontroller und Digitale Elektronik ·