7 لایک
-
ممنون از پاسختون حالا ببینم چی میشه باز اگه سوالی داشتم مجدد میام مرسی..........
-
سلام.من میخوام با ماژول nrf داده به برد uno ارسال کنم و بعدشم بین برد و درایور l298 ارتباط برقرار کنم ...راهنمایی کنید لطفا...
-
سلام
بنابراین شما مدارتون یه بخش فرستنده داره و یه گیرنده
بخش فرستنده از یه آردوینو و nrf تشکیل شده و بخش گیرنده از یه آردوینو و nrf و درایور تشکیل میشه.
شما از سمت فرستنده کد مورد نظرتون رو میفرستید و در سمت گیرنده اون رو دریافت میکنید. در سمت گیرنده داده ای که اومده رو پردازش میکنید و موتور را راه اندزای میکنید.
ok?
-
سلام دوستان
من میخوام با ماژول NRF یک فرستنده گیرنده راه بندازم که هنگامی که در برد اول پایه ی 14 یک شد در برد دوم این پایه یک بشه
من از دو تا آردوینو 2560 و دو تاماژول NRF24L01 استفاده کردم
برنامه برد اول که فرستنده است رو این طور نوشتم:
#include <SPI.h>
#include <Mirf.h>
#include <NRF24L01.h>
#include <MirfHardwarespiDriver.h>
int led = 14;
int i;
void setup() {
pinMode(led, INPUT);
Serial.begin(9600);
Mirf.spi=&MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte*)"clie2");
Mirf.setTADDR((byte*)"clie1");
Mirf.payload=sizeof(unsigned long);
Mirf.config();
byte rf_setup=0;
Mirf.readRegister(RF_SETUP , &rf_setup,sizeof(rf_setup));
if(rf_setup!=0)
Serial.println("beginning");
else
{Serial.println("no signal");
while(rf_setup=0);}
delay(1000);
}
void loop() {
pinMode(led, INPUT);
if(digitalRead(led)==HIGH)
{
i=0;
Mirf.send((byte*)&i);
}
}
برنامه برد دوم ه گیرنده هست رو این طور نوشتم:
#include <SPI.h>
#include <Mirf.h>
#include <NRF24L01.h>
#include <MirfHardwarespiDriver.h>
int led = 14;
int i;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
Mirf.spi=&MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte*)"clie1");
Mirf.setTADDR((byte*)"clie2");
Mirf.payload=sizeof(unsigned long);
Mirf.config();
byte rf_setup=0;
Mirf.readRegister(RF_SETUP , &rf_setup,sizeof(rf_setup));
if(rf_setup!=0)
Serial.println("beginning");
else
{Serial.println("no signal");
while(rf_setup=0);}
delay(1000);
}
void loop() {
while(!Mirf.dataReady())
{
Mirf.getData((byte *) &i);
digitalWrite(led, HIGH);
}
}
اما هیچ جوابی نمیگیرم . به محض اتصال برد دوم به تغذیه LED متصل به پایه 14 برد دوم روشن میشه و روشن میمونه
اگه کسی در این مورد میدونه لطفا بگه من چه کار کنم؟؟؟؟؟؟؟؟؟؟
-
دوست من اکیدا پیشنهاد می کنم از کدی که تو سایت هست در این لینک فروم استفاده کنی:
http://forum.arduino.ir/8/21/144.html
کد آمادش میشه اینا:
سمت فرستنده:
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
const int MAX_BUFFER_LEN = 16;
String Receive_Address = "clie1"; //A name that is dedicated to this station; MAX is 5 Char.
String Send_Address = "clie2"; //A name that is dedicated to another station; MAX is 5 Char.
byte Transfer_Lock = 0;
void setup()
{
Serial.begin(9600);
Setup_Mirf(); // initializing overall needed...
sendData("TALK");
}
void loop()
{
if (digitalRead(13) == HIGH) {
sendData("1");
}
}
//This function sends a 4 byte packet
void sendPacket(char packet[5])
{
Mirf.send((byte *)packet);
while (Mirf.isSending());
}
//This function sends data
void sendData(String strData)
{
int StrLen = 0;
String tmp_Str = "";
Serial.print("sending data: ");
Serial.print(strData);
Transfer_Lock = 1;
StrLen = strData.length();
Serial.print(" : ");
Serial.println(StrLen);
//parsing the data to 4 character packets (byte *)packet
while (StrLen > 0)
{
char tmp_Char[5] = {0};
if (StrLen > 4)
{
tmp_Str = strData.substring(0, 4);
strData = strData.substring(4);
}
else
{
tmp_Str = strData;
strData = "";
}
tmp_Str.toCharArray(tmp_Char, 5);;
sendPacket(tmp_Char);
StrLen = strData.length();
}
Transfer_Lock = 0;
}
//This function initializes overall needed for wireless communication
void Setup_Mirf()
{
char Receive_Adr_Char[6];
char Send_Adr_Char[6];
Receive_Address.toCharArray(Receive_Adr_Char, 6);
Send_Address.toCharArray(Send_Adr_Char, 6);
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)Receive_Adr_Char);
Mirf.setTADDR((byte *)Send_Adr_Char);
Mirf.payload = sizeof(unsigned long);
Mirf.config();
//reg - Start
byte rf_setup = 0;
Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) );
if (rf_setup != 0)
Serial.println("Beginning ... ");
else
{
Serial.println( "Wireless did not initialize!" );
while (rf_setup == 0);
}
delay(100);
}
سمت گیرنده:
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
const int MAX_BUFFER_LEN = 16;
String Receive_Address = "clie2"; //A name that is dedicated to this station; MAX is 5 Char.
String Send_Address = "clie1"; //A name that is dedicated to another station; MAX is 5 Char.
String strMirfBuffer="";
byte Transfer_Lock=0;
void setup()
{
Serial.begin(9600);
Setup_Mirf(); // initializing overall needed...
}
void loop()
{
if (!Mirf.isSending())
check_MirfBuffer();
}
//This function checks mirf data availability. if data is available, put it in the buffer and generates an event.
void check_MirfBuffer()
{
if (Mirf.dataReady())
{
while(Mirf.dataReady())
{
int tmp_index=0;
byte tmp_buffer[4]={0};
Mirf.getData(tmp_buffer);
while(tmp_buffer[tmp_index] && tmp_index<4 )
{
strMirfBuffer = strMirfBuffer + char(tmp_buffer[tmp_index]);
tmp_index++;
}
if (strMirfBuffer.length() >= MAX_BUFFER_LEN )
buffer_ready();
if (!Mirf.dataReady())
delay(2);
}
}
else if (strMirfBuffer.length()>0 )
buffer_ready();
}
//This function parses received commands from another nrfs.
void buffer_ready()
{
if (strMirfBuffer == "1")
{
digitalWrite(13,HIGH);
}
clear_buffer();
}
//This function initializes overall needed for wireless communication
void Setup_Mirf()
{
char Receive_Adr_Char[6];
char Send_Adr_Char[6];
Receive_Address.toCharArray(Receive_Adr_Char, 6);
Send_Address.toCharArray(Send_Adr_Char, 6);
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)Receive_Adr_Char);
Mirf.setTADDR((byte *)Send_Adr_Char);
Mirf.payload = sizeof(unsigned long);
Mirf.config();
//reg - Start
byte rf_setup = 0;
Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) );
if (rf_setup != 0)
Serial.println("Beginning ... ");
else
{
Serial.println( "Wireless did not initialize!" );
while (rf_setup==0);
}
delay(100);
}
//This function clears the buffer
void clear_buffer ()
{
strMirfBuffer="";
}
-
دوست من یک جا هم سوالتون رو مطرح کنید جواب میگیرید
-
مرسی از راهنماییتون
آخه نمیدونستم کدوم یکی از این موضوعات nrf به پروژه من شبیه تره تو همشون نوشتم
-
سلام دوستان
من میخام از دوتا برد pro mini و دوتا گیرنده فرستنده nrfاستفاده کنم
میشه کمک کنید پایه های ce ,csn به کدوم پین بردم باید وصل کنم
خیلی احتیاجمه لطفا کمک کنید مرسی
-
سلام دوستان اطلاعات 5تا ماژول دیگه رو دارم جمع آوری میکنم(یعنی در واقع یه حسگر) وا با کمک ماژل nrf دارم میفرستم به سمت گیرنده . حالا من از این حسگرها 4 تا دارم که هر 4 تا دارند اطلاعاتشونو به صورت مستقیم به گیرنده می فرستند. مشکلی که من دارم در سمت گیرنده اطلاعات هر 4 تا حسگر و با هم نمیگیره.عکس و کد میزارم
متاسفانه پشت سر هم نمیگره یه حسگرو میگیره مثلا شماره 1 بعد حسگرها تا شماره 4 همگی اطلاعاتشون صفر نشون میده.بعدش حسگر 2باید بگیره میره حسگر 3 رو نشون میده
اینم کد گیرنده و یکی از حسگرها فرستنده
فرستنده :
int encoder_pin = 3; // The pin the encoder is connected
unsigned int rpm; // rpm reading
volatile byte pulses; // number of pulses
unsigned long timeold;
// The number of pulses per revolution
// depends on your index disc!!
unsigned int pulsesperturn = 12;
int measurePin = A3;
int ledPower = 2;
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float d = 0;
void counter()
{
//Update count
pulses++;
}
#include "MQ135.h"
#include <RF24_config.h>
#include <Wire.h> //I2C Arduino Library
#include "DHT.h"
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//#include <SharpDust.h>
/*-----( Declare Constants and Pin Numbers )-----*/
//#define CE_PIN 9
//#define CSN_PIN 10
//#define JOYSTICK_X A0
//#define JOYSTICK_Y A1
int number = 0;
int state = 0;
MQ135 gasSensor = MQ135(A1);
int rzero = gasSensor.getRZero();
int ppm = gasSensor.getPPM();
#define DHTPIN A0 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DUST_LED_PIN 2
//#define DUST_MEASURE_PIN A3
#define HMC5883L_ADDR 0x1E
//#define HMC5883_WriteAddress 0x1E // i.e 0x3C >> 1
//#define HMC5883_ModeRegisterAddress 0x02
//#define HMC5883_ContinuousModeCommand 0x00
//#define HMC5883_DataOutputXMSBAddress 0x03
#include <Wire.h>
#define HMC5883L_ADDR 0x1E //0011110b, I2C 7bit address of HMC5883
bool haveHMC5883L = false;
bool detectHMC5883L ()
{
// read identification registers
Wire.beginTransmission(HMC5883L_ADDR); //open communication with HMC5883
Wire.write(10); //select Identification register A
Wire.endTransmission();
Wire.requestFrom(HMC5883L_ADDR, 3);
if(3 == Wire.available()) {
char a = Wire.read();
char b = Wire.read();
char c = Wire.read();
if(a == 'H' && b == '4' && c == '3')
return true;
}
return false;
//int regb=0x01;
//int regbdata=0x40;
//int outputData[6];
}
// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipes[6] = {0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL, 0xF0F0F0F0C3LL,0xF0F0F0F0C4LL,0xF0F0F0F0C5LL,0xF0F 0F0F0C6LL };
/*-----( Declare objects )-----*/
RF24 radio(9,10); // Create a Radio
/*-----( Declare Variables )-----*/
DHT dht(DHTPIN, DHTTYPE);
//SharpDust a(DUSTPIN, DUSTMEASUREPIN);
byte joystick[24]; // 2 element array holding Joystick readings
void setup() /****** SETUP: RUNS ONCE ******/
{
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipes[2]);
radio.openReadingPipe(1,pipes[0]);
dht.begin();
// SharpDust.begin(DUST_LED_PIN, DUST_MEASURE_PIN);
Wire.begin();
TWBR = 78; // 25 kHz
TWSR |= _BV (TWPS0); // change prescaler
pinMode(encoder_pin, INPUT);
pinMode(ledPower,OUTPUT);
//Interrupt 0 is digital pin 2, so that is where the IR detector is connected
//Triggers on FALLING (change from HIGH to LOW)
attachInterrupt(1, counter, FALLING);
// Initialize
pulses = 0;
rpm = 0;
timeold = 0;
}
//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
int rzero = gasSensor.getRZero(); //MQ135
int co2_ppm = gasSensor.getPPM();
int ppm = (co2_ppm / 4);
digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(samplingTime);
voMeasured = analogRead(measurePin); // read the dust value
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(sleepTime);
calcVoltage = voMeasured * (3.3 / 1024)*10;
d = (0.17 * calcVoltage - 0.1)*10;
int h = dht.readHumidity();
int t = dht.readTemperature();
// int d=SharpDust.measure();
int angle;
int i,x,y,z;
bool detect = detectHMC5883L();
if(!haveHMC5883L)
{
if(detect)
{
haveHMC5883L = true;
// Serial.println("We have HMC5883L, moving on");
// Put the HMC5883 IC into the correct operating mode
Wire.beginTransmission(HMC5883L_ADDR); //open communication with HMC5883
Wire.write(0x02); //select mode register
Wire.write(0x00); //continuous measurement mode
Wire.endTransmission();
}
}
Wire.beginTransmission(HMC5883L_ADDR);
Wire.write(0x03); //select register 3, X MSB register
Wire.endTransmission();
Wire.requestFrom(HMC5883L_ADDR, 6);
if(Wire.available())
{
x = Wire.read()<<8; //X msb
x |= Wire.read(); //X lsb
z = Wire.read()<<8; //Z msb
z |= Wire.read(); //Z lsb
y = Wire.read()<<8; //Y msb+
y |= Wire.read(); //Y ls
}
angle= atan2((int)y,(int)x) * (180 / 3.14159265) + 180; // angle in degrees
if (millis() - timeold >= 1000){ /*Uptade every one second, this will be equal to reading frecuency (Hz).*/
//Don't process interrupts during calculations
detachInterrupt(0);
//Note that this would be 60*1000/(millis() - timeold)*pulses if the interrupt
//happened once per revolution
rpm = (((60 * 1000 / pulsesperturn )/ (millis() - timeold)* pulses));
timeold = millis();
pulses = 0;
//Write it out to serial port
// Serial.print("RPM = ");
//Serial.print(rpm,DEC);
//Restart the interrupt processing
attachInterrupt(0, counter, FALLING);
}
// Serial.print(" y = ");
//joystick[4] = y;
// Serial.print(joystick[4]);
// Serial.print(" z = ");
// joystick[5] = z;
// Serial.print(joystick[5]);
Serial.print(" H = ");
joystick[0] = h;
Serial.print(joystick[0]);
Serial.print(" T = ");
joystick[1] = t;
Serial.print(joystick[1]);
Serial.print(" dust = ");
joystick[2] = d;
Serial.print(joystick[2]);
Serial.print(" angle = ");
joystick[3] = angle;
Serial.print(joystick[3]);
Serial.print(" CO2 PPM = ");
joystick[4] = ppm;
Serial.print(joystick[4]);
Serial.print(" rpm = ");
joystick[5]= rpm;
Serial.println(joystick[5]);
radio.write( joystick, sizeof(joystick) );
//delay(1000);
}//--(end main loop )---
/*-----( Declare User-written Functions )-----*/
//NONE
//*********( THE END )***********
گیرنده
-
ببخشید اینم گیرنده
#include <nRF24L01.h>
//#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
//#include <nRF24L01.h>
//#include "printf.h"
//#include <RF24.h>
//#include <RF24_config.h>
//#include <RF24_config.h>
#include <SPI.h>
//#include <nRF24L01.h>
//#include <RF24.h>
//#include <Wire.h>
//#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display
/*-----( Declare Constants and Pin Numbers )-----*/
//#define CE_PIN 9
//#define CSN_PIN 10
// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipes[6] = {0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL, 0xF0F0F0F0C3LL,0xF0F0F0F0C4LL,0xF0F0F0F0C5LL,0xF0F 0F0F0C6LL };
/*-----( Declare objects )-----*/
RF24 radio(9, 10); // Create a Radio
/*-----( Declare Variables )-----*/
byte joystick[30]; // 2 element array holding Joystick readings
//byte joystickk[12];
//byte joystickk1[18];
//byte joystickk2[24];
void setup() /****** SETUP: RUNS ONCE ******/
{
Serial.begin(9600);
delay(1000);
Serial.println("Nrf24L01 Receiver Starting");
radio.begin();
radio.openReadingPipe(1, pipes[1]);
radio.openReadingPipe(2, pipes[2]);
radio.openReadingPipe(3, pipes[3]);
radio.openReadingPipe(4, pipes[4]);
radio.startListening();;
// lcd.init(); // initialize the lcd
// lcd.backlight();
}//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
if ( radio.available() )
{
// Read the data payload until we've received everything
// bool done = false;
// while (!done)
// {
// radio.read(joystickk2, 24);
//for(int i=18;i<24;i++){
//}
// Fetch the data payload
// radio.read( joystick, sizeof(joystick) );
// radio.read( joystickk, sizeof(joystickk) );
// radio.read( joystickk1, sizeof(joystickk1) );
radio.read(joystick, 30);
//for(int i=0;i<=5;i++){
Serial.print("Humidity :");
Serial.print(joystick[0]);
Serial.print("%\t");
Serial.print("Temperature :");
Serial.print(joystick[1]);
Serial.print("*C\t");
Serial.print(F(" Dust :"));
Serial.print(joystick[2]);
Serial.print(F("mg/m^3\t"));
// delay(500);
Serial.print(" You are heading");
if (((joystick[3]) < 30.5) || ((joystick[3]) > 337.5 ))
Serial.print(" South\t");
if (((joystick[3]) > 30.5) && ((joystick[3]) < 50.5 ))
Serial.print(" South-West\t");
if (((joystick[3]) > 50.5) && ((joystick[3]) < 75.5 ))
Serial.print(" West\t");
if (((joystick[3]) > 75.5) && ((joystick[3]) < 140.5 ))
Serial.print(" North-West\t");
if (((joystick[3]) > 140.5) && ((joystick[3]) < 185.5 ))
Serial.print(" North\t");
if (((joystick[3]) > 185.5) && ((joystick[3]) < 200.5 ))
Serial.print(" NorthEast\t");
if (((joystick[3]) > 200.5) && ((joystick[3]) < 260.5 ))
Serial.print(" East\t");
if (((joystick[3]) > 260.5) && ((joystick[3]) < 337.5 ))
Serial.print(" SouthEast\t");
if ((0 < (joystick[3])) && ((joystick[3]) < 180) )
{
(joystick[3]) = (joystick[3]);
}
else
{
(joystick[3]) = 360 - (joystick[3]);
}
Serial.print(" CO2 ppm :");
Serial.print(joystick[4]);
Serial.print(" rpm :");
Serial.println(joystick[5]);
// Fetch the data payload
Serial.print("Humidity1 :");
Serial.print(joystick[6]);
Serial.print("%\t");
Serial.print("Temperature1 :");
Serial.print(joystick[7]);
Serial.print("*C\t");
Serial.print(F(" Dust1 :"));
Serial.print(joystick[8]);
Serial.print(F("mg/m^3\t"));
// delay(100);
Serial.print(" You are heading1");
if (((joystick[9]) < 30.5) || ((joystick[9]) > 337.5 ))
Serial.print(" South\t1");
if (((joystick[9]) > 30.5) && ((joystick[9]) < 50.5 ))
Serial.print(" South-West\t");
if (((joystick[9]) > 50.5) && ((joystick[9]) < 75.5 ))
Serial.print(" West\t");
if (((joystick[9]) > 75.5) && ((joystick[9]) < 140.5 ))
Serial.print(" North-West\t");
if (((joystick[9]) > 140.5) && ((joystick[9]) < 185.5 ))
Serial.print(" North\t");
if (((joystick[9]) > 185.5) && ((joystick[9]) < 200.5 ))
Serial.print(" NorthEast\t");
if (((joystick[9]) > 200.5) && ((joystick[9]) < 260.5 ))
Serial.print(" East\t");
if (((joystick[9]) > 260.5) && ((joystick[9]) < 337.5 ))
Serial.print(" SouthEast\t");
if ((0 < (joystick[9])) && ((joystick[9]) < 180) )
{
(joystick[9]) = (joystick[9]);
}
else
{
(joystick[9]) = 360 - (joystick[9]);
}
Serial.print(" CO2 ppm1 :");
Serial.print(joystick[10]);
Serial.print(" rpm1 :");
Serial.println(joystick[11]);
// else if (
Serial.print("Humidity2 :");
Serial.print(joystick[12]);
Serial.print("%\t");
Serial.print("Temperature2 :");
Serial.print(joystick[13]);
Serial.print("*C\t");
Serial.print(F(" Dust2 :"));
Serial.print(joystick[14]);
Serial.print(F("mg/m^3\t"));
//delay(500);
Serial.print(" You are heading2");
if (((joystick[15]) < 30.5) || ((joystick[15]) > 337.5 ))
Serial.print(" South\t1");
if (((joystick[15]) > 30.5) && ((joystick[15]) < 50.5 ))
Serial.print(" South-West\t");
if (((joystick[15]) > 50.5) && ((joystick[15]) < 75.5 ))
Serial.print(" West\t");
if (((joystick[15]) > 75.5) && ((joystick[15]) < 140.5 ))
Serial.print(" North-West\t");
if (((joystick[15]) > 140.5) && ((joystick[15]) < 185.5 ))
Serial.print(" North\t");
if (((joystick[15]) > 185.5) && ((joystick[15]) < 200.5 ))
Serial.print(" NorthEast\t");
if (((joystick[15]) > 200.5) && ((joystick[15]) < 260.5 ))
Serial.print(" East\t");
if (((joystick[15]) > 260.5) && ((joystick[15]) < 337.5 ))
Serial.print(" SouthEast\t");
if ((0 < (joystick[15])) && ((joystick[15]) < 180) )
{
(joystick[15]) = (joystick[15]);
}
else
{
(joystick[9]) = 360 - (joystick[9]);
}
Serial.print(" CO2 ppm2 :");
Serial.print(joystick[16]);
Serial.print(" rpm2 :");
Serial.println(joystick[17]);
Serial.print("Humidity3 :");
Serial.print(joystick[18]);
Serial.print("%\t");
Serial.print("Temperature3 :");
Serial.print(joystick[19]);
Serial.print("*C\t");
Serial.print(F(" Dust3 :"));
Serial.print(joystick[20]);
Serial.print(F("mg/m^3\t"));
// delay(500);
Serial.print(" You are heading3");
if (((joystick[21]) < 30.5) || ((joystick[21]) > 337.5 ))
Serial.print(" South\t1");
if (((joystick[21]) > 30.5) && ((joystick[21]) < 50.5 ))
Serial.print(" South-West\t");
if (((joystick[21]) > 50.5) && ((joystick[21]) < 75.5 ))
Serial.print(" West\t");
if (((joystick[21]) > 75.5) && ((joystick[21]) < 140.5 ))
Serial.print(" North-West\t");
if (((joystick[21]) > 140.5) && ((joystick[21]) < 185.5 ))
Serial.print(" North\t");
if (((joystick[21]) > 185.5) && ((joystick[21]) < 200.5 ))
Serial.print(" NorthEast\t");
if (((joystick[21]) > 200.5) && ((joystick[21]) < 260.5 ))
Serial.print(" East\t");
if (((joystick[21]) > 260.5) && ((joystick[21]) < 337.5 ))
Serial.print(" SouthEast\t");
if ((0 < (joystick[21])) && ((joystick[21]) < 180) )
{
(joystick[21]) = (joystick[21]);
}
else
{
(joystick[21]) = 360 - (joystick[21]);
}
Serial.print(" CO2 ppm3 :");
Serial.print(joystick[22]);
Serial.print(" rpm3 :");
Serial.println(joystick[23]);
// delay(500);
//Serial.print(joystickk2[i]);
// delay(500);
//}
//lcd.clear();
//lcd.setCursor(0,0);
//lcd.print("Channel: ");
//lcd.print(data[0]);
//lcd.setCursor(0,1);
//lcd.print("H: ");
//lcd.print(data[1]);
//lcd.print(" T: ");
//lcd.print(data[2]);
// } // delay(500);
}
else
{
Serial.println("No radio available");
//lcd.clear();
//lcd.print("No radio available");
// delay(500);
}
}//--(end main loop )---]
/*-----( Declare User-written Functions )-----*/
//NONE
//*********( THE END )***********
مجوز های ارسال و ویرایش
- شما نمیتوانید موضوع جدیدی ارسال کنید
- شما امکان ارسال پاسخ را ندارید
- شما نمیتوانید فایل پیوست کنید.
- شما نمیتوانید پست های خود را ویرایش کنید
-
مشاهده قوانین انجمن
SEO by vBSEO