Home > other >  Arduino NANO 9 v power supply problems
Arduino NANO 9 v power supply problems

Time:12-05

With 9 v3a power supply, control of small lights lit, but electricity beyond the reasonable control in a minute, after the switch to 6 v power supply can be normal use, what reason is this?
With 9 v power supply, control 485 9600 baud rate of communication can't normal communication, to 115200 baud rate can normal communication, what reason be?
Please everyone a great god help below the answer!!!!!
And control of NANO 10 pin is there any special meaning, with 10 pin control small lights up, beyond the reasonable control, and what is the reason?

Int c=0;
Int var=0;
Int a=0;
Uint8_t buffer [2]="a1";
String comdata="";
String str;
String tcaspass;
String tcasfail;
String topant;
String botant;
String HDG.
String ralog;
String tadisp;
String radisp;
String radalt;
String xpdrbus;
String att;

Int testPin=13;//button pin definition

Void setup ()
{
Serial. The begin (9600, SERIAL_8O1);

PinMode (testPin, INPUT_PULLUP);//set button on the pin pull input mode
pinMode(2, OUTPUT);
PinMode (3, the OUTPUT);
PinMode (4, the OUTPUT);
PinMode (5, the OUTPUT);
PinMode (6, the OUTPUT);
PinMode (7, the OUTPUT);
PinMode (8, the OUTPUT);
PinMode (9, the OUTPUT);
PinMode (10, the OUTPUT);
PinMode (11, the OUTPUT);
pinMode(12, OUTPUT);

}


Void Recive485 ()
{
While (Serial. The available () & gt; 0)
{
Comdata +=char (Serial. The read ());
Delay (2);
}
If (comdata. Length () & gt; 0)
{
//Serial. Println (comdata);
STR=comdata;
comdatahttps://bbs.csdn.net/topics/="";
}
}

Void the Send ()
{
If (digitalRead (testPin)==HIGH)
{
Buffer [1]=0 x41;
Buffer [1]=0 x31;
Serial. Write (buffer, 2);
Serial. Println (" ");
Delay (100);
}
The else
{
DigitalWrite (10, LOW);
}
}

Void choose ()
{
If (digitalRead (testPin)==HIGH)//a button press
{
delay(20);//delay to jitter
If (digitalRead (testPin)==HIGH)//a button press
{
DigitalWrite (2, HIGH);
DigitalWrite (3, HIGH);
DigitalWrite (4, HIGH);
DigitalWrite (5, HIGH);
DigitalWrite (6, HIGH);
DigitalWrite (7, HIGH);
DigitalWrite (8, HIGH);
DigitalWrite (9, HIGH);
DigitalWrite (10, HIGH);
DigitalWrite (11, HIGH);
DigitalWrite (12, HIGH);
Delay (3000);
DigitalWrite (2, LOW);
DigitalWrite (3, LOW);
DigitalWrite (4, LOW);
DigitalWrite (5, LOW);
DigitalWrite (6, LOW);
DigitalWrite (7, LOW);
DigitalWrite (8, LOW);
DigitalWrite (9, LOW);
DigitalWrite (10, LOW);
DigitalWrite (11, LOW);
DigitalWrite (12, LOW);
If (STR) length ()==47)
{
Tcaspass=STR. The substring (0, 2);
If (tcaspass=="A1") {digitalWrite (2, LOW); }
If (tcaspass=="A2") {digitalWrite (2, HIGH); }

Tcasfail=STR. The substring (2, 4);
If (tcasfail=="B1") {digitalWrite (4, LOW); }
If (tcasfail=="B2") {digitalWrite (4, HIGH); }

Topant=STR. The substring (4, 6);
If (topant=="C1") {digitalWrite (6, LOW); }
If (topant=="C2") {digitalWrite (6, HIGH); }

Botant=STR. The substring (6, 8);
If (botant=="D1") {digitalWrite (8, LOW); }
If (botant=="D2") {digitalWrite (8, HIGH); }

HDG=STR. The substring (8, 10);
If (HDG=="E1") {digitalWrite (10, LOW); }
If (HDG=="E2") {digitalWrite (10, HIGH); }


Ralog=STR. The substring (10, 12);
If (ralog=="F1") {digitalWrite (12, LOW); }
If (ralog=="F2) {digitalWrite (12, HIGH); }

Tadisp=STR. The substring (12, 14);
If (tadisp=="G1") {digitalWrite (3, LOW); }
If (tadisp=="G2") {digitalWrite (3, HIGH); }

Radisp=STR. The substring (dec 14);
If (radisp=="H1") {digitalWrite (5, LOW); }
If (radisp=="H2) {digitalWrite (5, HIGH); }

Radalt=STR. The substring (16, 18);
If (radalt=="I1) {digitalWrite (7, LOW); }
If (radalt=="I2) {digitalWrite (7, HIGH); }

Xpdrbus=STR. The substring (18, 20);
If (xpdrbus=="J1") {digitalWrite (9, LOW); }
If (xpdrbus=="J2") {digitalWrite (9, HIGH); }

Att=STR. The substring (20, 22);
If (att=="K1") {digitalWrite (11, LOW); }
If (att=="K2") {digitalWrite (11, HIGH); }

}
The else
{
DigitalWrite (2, HIGH);
}
}
}
}

Void loop ()
{
Recive485 ();
The Send ();
Choose ();
}
  • Related