Про newsoftserial....
Вот такое не работает,PHP код:#include <NewSoftSerial.h> //Include the NewSoftSerial library to send serial commands to the cellular module.
#include <string.h> //Used for string manipulations
char incoming_char=0; //Will hold the incoming character from the Serial Port.
NewSoftSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
void setup()
{
//Initialize serial ports for communication.
Serial.begin(9600);
cell.begin(9600);
//Let's get started!
Serial.println("Starting SM5100B Communication...");
}
void loop() {
//If a character comes in from the cellular module...
if(cell.available() >0)
{
incoming_char=cell.read(); //Get the character from the cellular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
//If a character is coming from the terminal to the Arduino...
if(Serial.available() >0)
{
incoming_char=Serial.read(); //Get the character coming from the terminal
cell.print(incoming_char); //Send the character to the cellular module.
}
}
если взять скетч Chipa,
через терминал все ок, пробовал скетч написать, который бы слал в шилд данные, а ответы в серийный порт - там белеберда отображается.. то квадраты, то еще чегоPHP код:uint8_t ETX_Pin=3;
uint8_t ERX_Pin=2;
void setup()
{
pinMode(0, INPUT);
pinMode(1, OUTPUT);
pinMode(ETX_Pin, INPUT);
pinMode(ERX_Pin, OUTPUT);
}
void loop()
{
int pc2vrbot = digitalRead(0);
digitalWrite(ERX_Pin, pc2vrbot);
int vrbot2pc = digitalRead(ETX_Pin);
digitalWrite(1, vrbot2pc);
}
Вообще, простейший скетч - отображение символов вводимых склавиатуры(ардуина засылает обратно символ или цифру, которую ввели с клавы) - работает прекрасно, когда пытаюсь параллелить на строковый монитор - на мониторе единицы(1), в терминал-ахинея(((
С++ последний раз трогал 5 лет назад, после этого только на php писал.
Общение с железом требует выдержки и терпения((((




 
			
			 
					
				 Re: Помощь в программировании
 Re: Помощь в программировании
				 
					
					
					
						 Ответить с цитированием
  Ответить с цитированием