|
A klónok CH340 Soros-USB illesztőjének drivere ( Letöltés)
°. Fok jele. Mégis csak szebb a 23.63°C
Tényleg szebb.
Én még messze vagyok hogy ilyeneket tudjak
Nagyszerű.
Melyik 2 gomb működik?
És hogyan is nézki az összefésült programod?
Mert még mindég nem tudjuk miröl beszélünk!
Így néz ki a kettő egyben.
Ez még csak próbálkozás mert a teljes program nem így fog kinézni.
Arra gondoltam a két analóg bemenet akad össze.
Így csak a LEFT és a RIGHT gombok működnek. #include <LiquidCrystal.h>
LiquidCrystal lcd(12, 13, 8, 9, 10, 11);
float tempC;
int reading;
int tempPin = A1;
int lcd_key = 0;
int adc_key_in = 0;
#define btnRIGHT 0
#define btnUP 1
#define btnDOWN 2
#define btnLEFT 3
#define btnSELECT 4
#define btnNONE 5
int read_LCD_buttons()
{
adc_key_in = analogRead(0);
if (adc_key_in > 1000) return btnNONE;
// For V1.1 us this threshold
if (adc_key_in < 50) return btnRIGHT;
if (adc_key_in < 250) return btnUP;
if (adc_key_in < 450) return btnDOWN;
if (adc_key_in < 650) return btnLEFT;
if (adc_key_in < 850) return btnSELECT;
return btnNONE; // when all others fail, return this...
}
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
reading = analogRead(tempPin);
tempC = reading / 9.31;
lcd.setCursor(0, 0);
lcd.print("SZ:");
lcd.print(tempC);
lcd.print("C");
delay(1000);
lcd.setCursor(0,1);
lcd_key = read_LCD_buttons();
switch (lcd_key)
{
case btnRIGHT:
{
lcd.print("RIGHT ");
break;
}
case btnLEFT:
{
lcd.print("LEFT ");
break;
}
case btnUP:
{
lcd.print("UP ");
break;
}
case btnDOWN:
{
lcd.print("DOWN ");
break;
}
case btnSELECT:
{
lcd.print("SELECT");
break;
}
case btnNONE:
{
lcd.print("NONE ");
break;
}
}
}
Szerintem csinálj egy olyat, hogy kiíratod soros portra az adc_key_in értékét, és felírod amit kaptál bizonyos gombok lenyomásakor.
Aztán ennek megfelelően módosítod eme képlet alapján: (adc_key_in > 800 and adc_key_in < 820).
Persze a megfelelő helyekre a saját kapott értékét írd.
Köszi az ötletet kipróbálom.
Valószínű, hogy a CH340 van rajta. Kell hozzá illesztőprogi, és megy.
Sziasztok! Azt tudom, hogy ha szöveget iratok lcd-re, serialra, stb. akkor f()-be kell raknom, hogy ne a ram-ot húzza, viszont ha write()-tal iratom, akkor nem hagyja. Mi a különbség a write, és a print között? Előre is köszi!
Flashban-ból csak 'const'-ot olvashatsz!
Változók csak a Ramban vannak, lehetnek.
Azt tudom hogy a változók csak ramban, de a fix szövegek, azokat print(f(""));-fel irassam, vagy simán write(""); ?
Értelem szerint a:
print(f("")); a flashból olvas. Nem foglal memóriát!
write("Szoveg"); előbb betölti a ramba "Szoveg" konstanst és onnan kerül kiírásra.
Ha spórolni akarsz a Rammal az előző verziót használod! Ennyi.
Sziasztok, kér db arduino nano-val (16MHz-en járnak) használok egy egy NRF24L01 modult, viszont nekem irtó lassúnak tűnik az adatátvitel. A vevőn ha soros monitoron nézem a kapott adatokat kb 2-4 csomag jön 1sec alatt. Az RF modulok 2Mbit/s-re vannak állítva az újraküldés pedig 0-ra. (fontosabb a friss adat mint hogy minden megjöjjön) Radiohed féle library-t használom.
Az adó:
/* YourDuinoStarter Example: TRANSMIT nRF24L01 Joystick data to Pan Tilt Over Radio.
QUESTIONS? terry@yourduino.com
- WHAT IT DOES: Reads Joystick Analog Values on A0, A1 and transmits
them over a nRF24L01 Radio Link, using the Radiohead library.
- TODO! Send the Joystick push-down click to turn Laser on and off
- SEE the comments after "//" on each line below
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
1 - GND
2 - VCC 3.3V !!! NOT 5V
3 - CE to Arduino pin 8
4 - CSN to Arduino pin 10
5 - SCK to Arduino pin 13
6 - MOSI to Arduino pin 11
7 - MISO to Arduino pin 12
8 - UNUSED
-
Analog Joystick or two 10K potentiometers:
GND to Arduino GND
VCC to Arduino +5V
X Pot to Arduino A5
Y Pot to Arduino A4
Click Button to pin 4
-V2.00 7/12/14 by Noah King
*/
/*-----( Import needed libraries )-----*/
// SEE http://arduino-info.wikispaces.com/Arduino-Libraries !!
// NEED the RadioHead Library installed!
#include <RHReliableDatagram.h>
#include <SPI.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define JoyStick_X_PIN A5 //elore hatra
#define JoyStick_Y_PIN A4 //balra jobbra
#define Offset_PIN A6 //offset
#define buttonPin 2
#define CLIENT_ADDRESS 5 // For Radio Link
#define SERVER_ADDRESS 6
// Create an instance of the radio driver
// Create an instance of a manager object to manage message delivery and receipt, using the driver declared above
RHReliableDatagram RadioManager (RadioDriver, CLIENT_ADDRESS ); // sets the driver to NRF24 and the client adress to 1
/*-----( Declare Variables )-----*/
uint8_t joystick[4]; // 2 element array of unsigned 8-bit type, holding Joystick readings
// Predefine the message buffer here: Don't put this on the stack:
uint8_t buf [RH_ NRF24_MAX_MESSAGE_LEN ]; // Actually: 28 bytes (32 minus 4 byte header)
void setup() /****** SETUP: RUNS ONCE ******/
{
// begin serial to display on Serial Monitor. Set Serial Monitor to 115200
// See http://arduino-info.wikispaces.com/YourDuino-Serial-Monitor
Serial.begin(115200);
// NOTE: pinMode for Radio pins handled by RadioDriver
if (!RadioManager.init()) // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
Serial.println("init failed");
pinMode(buttonPin, INPUT);
}
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
//Read the joystick values, scale them to 8-bit type and store them in the joystick[] array.
Serial.println("Reading joystick values ");
// Take the value of Joystick voltages which are 0 to 1023 (10 bit), and convert them to 0 to 255 (8 bit)
joystick[0] = map(analogRead(JoyStick_X_PIN), 300, 723, 0, 255);
joystick[1] = map(analogRead(JoyStick_Y_PIN), 300, 723, 0, 255);
joystick[2] = map(analogRead(Offset_PIN), 300, 723, 0, 255);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (digitalRead(buttonPin) == HIGH)
{
joystick[3]=1;
}
else
{
joystick[3]=0;
}
//Display the joystick values in the serial monitor.
Serial.print("x:");
Serial.print(joystick[0]);//elore hatra
Serial.print(" y:");
Serial.print(joystick[1]); //balra jobbra
Serial.print(" z:");
Serial.print(joystick[2]); //offset
Serial.print(" gomb:");
Serial.println(joystick[3]); //gomb
// Serial.println("Sending Joystick data to nrf24_reliable_datagram_server");
//Send a message containing Joystick data to manager_server
if (RadioManager.sendtoWait(joystick, sizeof(joystick), SERVER_ADDRESS))
{
// Now wait for a reply from the server
uint8_t len = sizeof(buf);
uint8_t from;
if (1/*RadioManager.recvfromAckTimeout(buf, &len, 2000, &from)*/)
{
// Serial.print("got reply from : 0x");
// Serial.print(from, HEX);
// Serial.print(": ");
// Serial.println((char*)buf);
}
else
{
// Serial.println("No reply, is nrf24_reliable_datagram_server running?");
}
}
else
// Serial.println("sendtoWait failed");
delay(25); // Wait a bit before next transmission
}
És a vevő kódja:
/* YourDuinoStarter Example:RECEIVE nRF24L01 Joystick data to control Pan Tilt Servos Over Radio.
QUESTIONS? terry@yourduino.com
-WHAT IT DOES:
-Receives Joystick Analog Values over a nRF24L01 Radio Link, using the Radiohead library.
- Sends Joystick position to 2 servos, usually X,Y to pan-tilt arrangement
- TODO! Send the Joystick push-down click to turn Laser on and off
- SEE the comments after "//" on each line below
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
1 - GND
2 - VCC 3.3V !!! NOT 5V
3 - CE to Arduino pin 8
4 - CSN to Arduino pin 10
5 - SCK to Arduino pin 13
6 - MOSI to Arduino pin 11
7 - MISO to Arduino pin 12
8 - UNUSED
-V2.00 7/12/14 by Noah King
*/
/*-----( Import needed libraries )-----*/
// SEE http://arduino-info.wikispaces.com/Arduino-Libraries !!
// NEED the SoftwareServo library installed
#include <SoftwareServo.h> // Regular Servo library creates timer conflict!
// NEED the RadioHead Library installed!
#include <RHReliableDatagram.h>
#include <SPI.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CLIENT_ADDRESS 5
#define SERVER_ADDRESS 6
#define ServoHorizontalPIN 3 //Pin Numbers
#define ServoVerticalPIN 5
#define LaserPIN 6
#define ServoMIN_H 0 // Don't go to very end of servo travel
#define ServoMAX_H 160 // which may not be all the way from 0 to 180.
#define ServoMIN_V 0 // Don't go to very end of servo travel
#define ServoMAX_V 140 // which may not be all the way from 0 to 180.
/*-----( Declare objects )-----*/
//SoftwareServo HorizontalServo;
//SoftwareServo VerticalServo; // create servo objects to control servos
// Create an instance of the radio driver
// Create an instance of a manager object to manage message delivery and receipt, using the driver declared above
RHReliableDatagram RadioManager(RadioDriver, SERVER_ADDRESS);
/*-----( Declare Variables )-----*/
int HorizontalJoystickReceived; // Variable to store received Joystick values
int HorizontalServoPosition; // variable to store the servo position
int VerticalJoystickReceived; // Variable to store received Joystick values
int VerticalServoPosition; // variable to store the servo position
uint8_t ReturnMessage[] = "JoyStick Data Received"; // 28 MAX
// Predefine the message buffer here: Don't put this on the stack:
uint8_t buf [RH_ NRF24_MAX_MESSAGE_LEN ];
uint8_t tmp=0;
//--------------------------------( SETUP Runs ONCE )-----------------------------------------------------
void setup()
{
//pinMode(LaserPIN, OUTPUT);
//digitalWrite(LaserPIN, HIGH); // turn on Laser
/*-----( Set up servos )-----*/
//HorizontalServo.attach(ServoHorizontalPIN); // attaches the servo to the servo object
//VerticalServo.attach(ServoVerticalPIN); // attaches the servo to the servo object
// begin serial to display on Serial Monitor. Set Serial Monitor to 115200
// See http://arduino-info.wikispaces.com/YourDuino-Serial-Monitor
Serial.begin(115200);
if (!RadioManager.init()){ // Initialize radio. If NOT "1" received, it failed.
Serial.println("init failed");
}
else
{
Serial.println("init ok");
}
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
} // END Setup
//--------------------------------( LOOP runs continuously )-----------------------------------------------------
void loop()
{
if (RadioManager.available())
{
// Wait for a message addressed to us from the client
uint8_t len = sizeof(buf);
uint8_t from;
if (RadioManager.recvfromAck(buf, &len, &from))
//Serial Print the values of joystick
{
if(tmp<200){tmp++;}else{tmp=0;}
Serial.print("got request from : 0x");
Serial.print(from, HEX);
Serial.print(": X = ");
Serial.print(buf[0]);
Serial.print(" Y = ");
Serial.print(buf[1]);
Serial.print(" Z = ");
Serial.print(buf[2]);
Serial.print(" Gomb = ");
Serial.print(buf[3]);
Serial.print(" counter = ");
Serial.println(tmp);
// Send a reply back to the originator client, check for error
//if (!RadioManager.sendtoWait(ReturnMessage, sizeof(ReturnMessage), from))
//Serial.println(" sendtoWait failed");
}// end 'IF Received data Available
}// end 'IF RadioManager Available
{
// SoftwareServo::refresh();//refreshes servo to keep them updating
//HorizontalJoystickReceived = buf[1]; // Get the values received
//VerticalJoystickReceived = buf[0];
// scale it to use it with the servo (value between MIN and MAX)
// HorizontalServoPosition = map(HorizontalJoystickReceived, 0, 255, ServoMIN_H , ServoMAX_H);
// VerticalServoPosition = map(VerticalJoystickReceived, 0, 255, ServoMIN_V , ServoMAX_V);
// Serial.print("HorizontalServoPosition : ");
// Serial.print(HorizontalServoPosition);
// Serial.print(" VerticalServoPosition : ");
// Serial.println(VerticalServoPosition);
// tell servos to go to position
// HorizontalServo.write(HorizontalServoPosition);
// VerticalServo.write(VerticalServoPosition);
// delay(25); // wait for the servo to reach the position
}
}// END Main LOOP
Bármilyen tippnek örülök. Az lehet hogy csak a soros kiíratás lassítja be az egész adás-vétel folyamatot?
Biztos, hogy a terminál használat nagyon lassú!
Mi lenne, ha csak 4 – 5 LED-et villogtatnál if, else if utasításokkal?
A terminálra írások elhagyása biztosan felgyorsítja az adatátvitelt!
De ha nem kellenek a vételek visszaigazolása (ACK)?
Azzal is elérhetsz gyorsulást, ha a kevésbé biztonságos RHDatagram.h-t használod, RHReliableDatagram.h helyet.
Így nem vár az adó, visszaigazolásra a vevő oldaláról.
Meg spórolsz egy várakozást, csak vigyázni kel, hogy legyen ideje a vevőnek feldogozni a kapott utasítást a két adás között.
Próbáldki az ajánlott váltotatásokat!
Adó:
/* YourDuinoStarter Example: TRANSMIT nRF24L01 Joystick data to Pan Tilt Over Radio.
QUESTIONS? terry@yourduino.com
- WHAT IT DOES: Reads Joystick Analog Values on A0, A1 and transmits
them over a nRF24L01 Radio Link, using the Radiohead library.
- TODO! Send the Joystick push-down click to turn Laser on and off
- SEE the comments after "//" on each line below
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
1 - GND
2 - VCC 3.3V !!! NOT 5V
3 - CE to Arduino pin 8
4 - CSN to Arduino pin 10
5 - SCK to Arduino pin 13
6 - MOSI to Arduino pin 11
7 - MISO to Arduino pin 12
8 - UNUSED
-
Analog Joystick or two 10K potentiometers:
GND to Arduino GND
VCC to Arduino +5V
X Pot to Arduino A5
Y Pot to Arduino A4
Click Button to pin 4
-V2.00 7/12/14 by Noah King
*/
/*-----( Import needed libraries )-----*/
// SEE http://arduino-info.wikispaces.com/Arduino-Libraries !!
// NEED the RadioHead Library installed!
//#include <RHReliableDatagram.h>
#include <RHDatagram.h>
#include <SPI.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define JoyStick_X_PIN A5 //elore hatra
#define JoyStick_Y_PIN A4 //balra jobbra
#define Offset_PIN A6 //offset
#define buttonPin 2
#define CLIENT_ADDRESS 5 // For Radio Link
#define SERVER_ADDRESS 6
// Create an instance of the radio driver
// Create an instance of a manager object to manage message delivery and receipt, using the driver declared above
//RHReliableDatagram RadioManager(RadioDriver, CLIENT_ADDRESS);// sets the driver to NRF24 and the client adress to 1
RHDatagram RadioManager (RadioDriver, CLIENT_ADDRESS ); // sets the driver to NRF24 and the client adress to 1
/*-----( Declare Variables )-----*/
uint8_t joystick[4]; // 2 element array of unsigned 8-bit type, holding Joystick readings
// Predefine the message buffer here: Don't put this on the stack:
uint8_t buf [RH_ NRF24_MAX_MESSAGE_LEN ]; // Actually: 28 bytes (32 minus 4 byte header)
void setup() /****** SETUP: RUNS ONCE ******/
{
// begin serial to display on Serial Monitor. Set Serial Monitor to 115200
// See http://arduino-info.wikispaces.com/YourDuino-Serial-Monitor
Serial.begin(115200);
// NOTE: pinMode for Radio pins handled by RadioDriver
if (!RadioManager.init()) // Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
Serial.println("init failed");
pinMode(buttonPin, INPUT);
}
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
//Read the joystick values, scale them to 8-bit type and store them in the joystick[] array.
Serial.println("Reading joystick values ");
// Take the value of Joystick voltages which are 0 to 1023 (10 bit), and convert them to 0 to 255 (8 bit)
joystick[0] = map(analogRead(JoyStick_X_PIN), 300, 723, 0, 255);
joystick[1] = map(analogRead(JoyStick_Y_PIN), 300, 723, 0, 255);
joystick[2] = map(analogRead(Offset_PIN), 300, 723, 0, 255);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (digitalRead(buttonPin) == HIGH)
{
joystick[3]=1;
}
else
{
joystick[3]=0;
}
//Display the joystick values in the serial monitor.
Serial.print("x:");
Serial.print(joystick[0]);//elore hatra
Serial.print(" y:");
Serial.print(joystick[1]); //balra jobbra
Serial.print(" z:");
Serial.print(joystick[2]); //offset
Serial.print(" gomb:");
Serial.println(joystick[3]); //gomb
// Serial.println("Sending Joystick data to nrf24_reliable_datagram_server");
//Send a message containing Joystick data to manager_server
// if (RadioManager.sendtoWait(joystick, sizeof(joystick), SERVER_ADDRESS))
if (RadioManager.sendto(joystick, sizeof(joystick), SERVER_ADDRESS))
{
// Now wait for a reply from the server
uint8_t len = sizeof(buf);
uint8_t from;
if (1/*RadioManager.recvfromAckTimeout(buf, &len, 2000, &from)*/)
{
// Serial.print("got reply from : 0x");
// Serial.print(from, HEX);
// Serial.print(": ");
// Serial.println((char*)buf);
}
else
{
// Serial.println("No reply, is nrf24_reliable_datagram_server running?");
}
}
else
// Serial.println("sendtoWait failed");
delay(25); // Wait a bit before next transmission
}
Vevö:
/* YourDuinoStarter Example:RECEIVE nRF24L01 Joystick data to control Pan Tilt Servos Over Radio.
QUESTIONS? terry@yourduino.com
-WHAT IT DOES:
-Receives Joystick Analog Values over a nRF24L01 Radio Link, using the Radiohead library.
- Sends Joystick position to 2 servos, usually X,Y to pan-tilt arrangement
- TODO! Send the Joystick push-down click to turn Laser on and off
- SEE the comments after "//" on each line below
http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo
1 - GND
2 - VCC 3.3V !!! NOT 5V
3 - CE to Arduino pin 8
4 - CSN to Arduino pin 10
5 - SCK to Arduino pin 13
6 - MOSI to Arduino pin 11
7 - MISO to Arduino pin 12
8 - UNUSED
-V2.00 7/12/14 by Noah King
*/
/*-----( Import needed libraries )-----*/
// SEE http://arduino-info.wikispaces.com/Arduino-Libraries !!
// NEED the SoftwareServo library installed
//#include <SoftwareServo.h> // Regular Servo library creates timer conflict!
// NEED the RadioHead Library installed!
//#include <RHReliableDatagram.h>
#include <RHDatagram.h>
#include <SPI.h>
/*-----( Declare Constants and Pin Numbers )-----*/
#define CLIENT_ADDRESS 5
#define SERVER_ADDRESS 6
#define ServoHorizontalPIN 3 //Pin Numbers
#define ServoVerticalPIN 5
#define LaserPIN 6
#define ServoMIN_H 0 // Don't go to very end of servo travel
#define ServoMAX_H 160 // which may not be all the way from 0 to 180.
#define ServoMIN_V 0 // Don't go to very end of servo travel
#define ServoMAX_V 140 // which may not be all the way from 0 to 180.
/*-----( Declare objects )-----*/
//SoftwareServo HorizontalServo;
//SoftwareServo VerticalServo; // create servo objects to control servos
// Create an instance of the radio driver
// Create an instance of a manager object to manage message delivery and receipt, using the driver declared above
//RHReliableDatagram RadioManager(RadioDriver, SERVER_ADDRESS);
RHDatagram RadioManager(RadioDriver, SERVER_ADDRESS);
/*-----( Declare Variables )-----*/
int HorizontalJoystickReceived; // Variable to store received Joystick values
int HorizontalServoPosition; // variable to store the servo position
int VerticalJoystickReceived; // Variable to store received Joystick values
int VerticalServoPosition; // variable to store the servo position
uint8_t ReturnMessage[] = "JoyStick Data Received"; // 28 MAX
// Predefine the message buffer here: Don't put this on the stack:
uint8_t buf [RH_ NRF24_MAX_MESSAGE_LEN ];
uint8_t tmp=0;
//--------------------------------( SETUP Runs ONCE )-----------------------------------------------------
void setup()
{
//pinMode(LaserPIN, OUTPUT);
//digitalWrite(LaserPIN, HIGH); // turn on Laser
/*-----( Set up servos )-----*/
//HorizontalServo.attach(ServoHorizontalPIN); // attaches the servo to the servo object
//VerticalServo.attach(ServoVerticalPIN); // attaches the servo to the servo object
// begin serial to display on Serial Monitor. Set Serial Monitor to 115200
// See http://arduino-info.wikispaces.com/YourDuino-Serial-Monitor
Serial.begin(115200);
if (!RadioManager.init()){ // Initialize radio. If NOT "1" received, it failed.
Serial.println("init failed");
}
else
{
Serial.println("init ok");
}
// Defaults after init are 2.402 GHz (channel 2), 2Mbps, 0dBm
} // END Setup
//--------------------------------( LOOP runs continuously )-----------------------------------------------------
void loop()
{
if (RadioManager.available())
{
// Wait for a message addressed to us from the client
uint8_t len = sizeof(buf);
uint8_t from;
// if (RadioManager.recvfromAck(buf, &len, &from))
if (RadioManager.recvfrom(buf, &len, &from))
//Serial Print the values of joystick
{
if(tmp<200){tmp++;}else{tmp=0;}
Serial.print("got request from : 0x");
Serial.print(from, HEX);
Serial.print(": X = ");
Serial.print(buf[0]);
Serial.print(" Y = ");
Serial.print(buf[1]);
Serial.print(" Z = ");
Serial.print(buf[2]);
Serial.print(" Gomb = ");
Serial.print(buf[3]);
Serial.print(" counter = ");
Serial.println(tmp);
// Send a reply back to the originator client, check for error
//if (!RadioManager.sendtoWait(ReturnMessage, sizeof(ReturnMessage), from))
//Serial.println(" sendtoWait failed");
}// end 'IF Received data Available
}// end 'IF RadioManager Available
{
// SoftwareServo::refresh();//refreshes servo to keep them updating
//HorizontalJoystickReceived = buf[1]; // Get the values received
//VerticalJoystickReceived = buf[0];
// scale it to use it with the servo (value between MIN and MAX)
// HorizontalServoPosition = map(HorizontalJoystickReceived, 0, 255, ServoMIN_H , ServoMAX_H);
// VerticalServoPosition = map(VerticalJoystickReceived, 0, 255, ServoMIN_V , ServoMAX_V);
// Serial.print("HorizontalServoPosition : ");
// Serial.print(HorizontalServoPosition);
// Serial.print(" VerticalServoPosition : ");
// Serial.println(VerticalServoPosition);
// tell servos to go to position
// HorizontalServo.write(HorizontalServoPosition);
// VerticalServo.write(VerticalServoPosition);
// delay(25); // wait for the servo to reach the position
}
}// END Main LOOP
Ki próbáltam a ki íratást.
Rá jöttem mi a gond csak nem tudom hogy lehetne megoldani.
Ha benne van a setup-ban az analogReference(INTERNAL); akkor nem működik csak két gomb.
Ha ki veszem ezt belőle akkor megy az összes de ez kell a tized pontos hőmérséklet méréshez. A hozzászólás módosítva: Dec 21, 2015
Ha átállítod a belső referenciát 5V-ról 1.1V-ra, akkor nem kell újraszámolni a feszültség osztókon mérhető ADC értéket? Kapcsolástól függ a válasz.
Újra kellene számolni de ki íratom a adc_key_in értékét, a nem működő gombokra értéket sem ír, olyan mintha meg se nyomnám. A hozzászólás módosítva: Dec 21, 2015
Gondolom a függvény nem kezeli ezt a különleges állapotot.
Ha kivállasztom a balső 1,1 v-os referenciát egy UNO-nál és 5,5 v-ot adok rá akkor az kiégeti ? Vagyis az analog kivezetés akkor csak max 1,1 v-ot bír el ?
nem 5,5 v-ot akartam irni, hanem 5 v-ot.
Értelmesen az ADC akkor csak 1.1 V-os vagy az alatti értéket tud feldolgozni, de "kiégetni" csak a VCC-t 0.5 V-tal meghaladó bemenőjel fogja, tehát az 5 V-os jel nem.
Sziasztok.
Nemrégiben kezdtem el foglalkozni az Arduino-val. Az alapok már mennek. Vettem hozzá Led és Lcd kijelzőket. Kipróbálásukhóz a neten található „alap”kódokat akartam használni, ( Link1, Link2, Link3, és az lcd-hez is hasonló alap kódokkal próbálkoztam) de mikor az 1.6.5. vagy a 1.6.6 –ban a kódot leellenőriztetem „ Hiba a fordítás során” üzenetet kapom. Sajnos a hibás részt nem jelöli ki, így nem tudom mi lehet a hiba.
Kérnék egy kis segítséget a probléma megoldásához.
Idézet: „Ha kivállasztom a balső 1,1 v-os referenciát egy UNO-nál és 5 v-ot adok rá akkor az kiégeti ? Vagyis az analog kivezetés akkor csak max 1,1 v-ot bír el ?”
Koszi a vallaszt. Nem akarlak alabecsulni de azert szuksegem lenne meg egy par megerositesre is. Nem akarok kiserletezni. Remelem megerted.
Csak az Aref lábra ne adj ilyenkor 5V ot, a többi analógra mehet. Amúgy is érdemes minden lábra ellenállást esetleg kondenzátort tenni aluláteresztő szűrőnek.
Be kellene állítanod, ha látni akarod a teljes fordítási loggot!
Arduino:
File > Beállítások > Log mutatása – pipa.
pipa > Display line number. Hogy lásd a sorszámozást.
Oké. Köszi. A link1 kód hibaüzenete:
C:\Users\Asztali\AppData\Local\Temp\arduino_fc4e855426c7eca1e0d3debefdb191cc\sketch_dec23a.ino:1:27: fatal error: TM1637Display.h: No such file or directory
#include < TM1637Display.h>
compilation terminated.
exit status 1
Hiba a fordítás során.
Akkor az 1 sor a hibás? Abban mi lehet a hiba?
Mutatok egy egyszerű telepítési trükköt!
Az aktuális könyvtárba, most: TM1637Test.
Bemásolod az aktuális lib tartalmát, most:
TM1637Display.cpp, TM1637Display.h
Megváltoztatod a file elérési útvonal keresés módját:
Ahol szerepel: #include < TM1637Display.h>
Lecseréled: #include " TM1637Display.h" formára.
Ez esetben 2 helyen van: TM1637Display.cpp, TM1637Test.ino
Ezzel a módszerrel olvashatod és szerkesztheted minden használt alkalmazásodat.
(Persze ehhez az alapismereteknél már több tudás kel!)
De már így is sok trükköt elleshetsz.
(És még le is fordult hiba nélkül!)
Az TM1637Test.ino-t indítod! A hozzászólás módosítva: Dec 23, 2015
|
|