xyiii 0 Posted February 9, 2015 Share Posted February 9, 2015 I understand the code about UART with the serial monitor, What should I change if I want to have TX,RX send data to TX RX on another wifi module?? Please help!!!! const int analogInPin = P1_3; //Analog input pin that the output from the current sensor is attached to int ADCValue = 0; //value read from the output void setup() { Serial.begin(9600); pinMode(analogInPin,INPUT); } void loop() { ADCValue = analogRead(analogInPin); Serial.print("ADC = " ); Serial.println(ADCValue); delay(20); // fs=1/T sampling time with approx.50Hz signal } Quote Link to post Share on other sites
spirilis 1,265 Posted February 10, 2015 Share Posted February 10, 2015 I assume you have to have code to talk over a wifi module? And know the other node's IP address, TCP or UDP port it's listening on, etc? xyiii 1 Quote Link to post Share on other sites
xyiii 0 Posted February 10, 2015 Author Share Posted February 10, 2015 I assume you have to have code to talk over a wifi module? And know the other node's IP address, TCP or UDP port it's listening on, etc? This wifi module can be considered as another mcu, which does not need to know the IP address, but I wanted to ask how to write to the module using UART i.e. write to specific pins Quote Link to post Share on other sites
spirilis 1,265 Posted February 10, 2015 Share Posted February 10, 2015 This wifi module can be considered as another mcu, which does not need to know the IP address, but I wanted to ask how to write to the module using UART i.e. write to specific pins A second UART (e.g. Serial1 available on some MCUs), or disconnect the backchannel UART bridge jumpers and use the standard UART referenced by Serial. Quote Link to post Share on other sites
xyiii 0 Posted February 13, 2015 Author Share Posted February 13, 2015 A second UART (e.g. Serial1 available on some MCUs), or disconnect the backchannel UART bridge jumpers and use the standard UART referenced by Serial. Can you explain in a bit more details please? I have tried 'Serial 1' but it says undefined reference to `Serial1 I am not good at doing this Quote Link to post Share on other sites
spirilis 1,265 Posted February 13, 2015 Share Posted February 13, 2015 Can you explain in a bit more details please? I have tried 'Serial 1' but it says undefined reference to `Serial1 I am not good at doing this Chances are then the chip you're using doesn't have 2 serial ports. See if SoftwareSerial would work for your scenario or see if you even need the serial port at all... Fwiw, the MSP430 F5529 launchpad, FR5969 launchpads, the Tiva-C series launchpads all have more than 1 serial port. Quote Link to post Share on other sites
xyiii 0 Posted February 13, 2015 Author Share Posted February 13, 2015 Chances are then the chip you're using doesn't have 2 serial ports. See if SoftwareSerial would work for your scenario or see if you even need the serial port at all... Fwiw, the MSP430 F5529 launchpad, FR5969 launchpads, the Tiva-C series launchpads all have more than 1 serial port. Thank you so much for your reply! I am using MSP430G2553 launch pad. When i put SoftwareSerial it says 'SoftwareSerial' does not name a type, I can print onto serial monitor normally to read the ADC value but could not transmit that from pin 1.1 TXD to my wifi module RXD pin. When the msp430 is doing print to serial monitor, does that mean the pin1 and pin 2 would have the output as well? Quote Link to post Share on other sites
spirilis 1,265 Posted February 13, 2015 Share Posted February 13, 2015 Thank you so much for your reply! I am using MSP430G2553 launch pad. When i put SoftwareSerial it says 'SoftwareSerial' does not name a type, I can print onto serial monitor normally to read the ADC value but could not transmit that from pin 1.1 TXD to my wifi module RXD pin. When the msp430 is doing print to serial monitor, does that mean the pin1 and pin 2 would have the output as well? Yes, because on the MSP430G2 launchpad, the "backchannel UART" that you see over the USB just happens to be the same as the UART on pins (3 & 4, technically). So from here, you need to analyze what you intend to do with this - and whether that scenario is OK. I saw you post in another thread about connecting two launchpads with I2C or SPI or something. I recommend playing with that for now if you have another G2 launchpad. Getting experience with the "Wire" library (I2C) is good. Don't forget the pullup resistors you'll need on both those lines, and be sure to connect their GND's together. Otherwise I would recommend getting the F5529LP or FR5969LP for more I/O capability. xyiii 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.