Beginner needs help with Serial connection

HI guys, I'm kinda new to the arduino so i don't really have any idea of what I'm doing. I'm trying to get the Arduino to communicate with a Raspberry pi connected to it via USB. I have a soil moisture sensor and a temp sensor connected to the arduino, and the Rpi is displaying a webpage with the values for the moisture and temp. What i need to know is how can i get the arduino to read and update the data and print to the serial monitor ONLY when the Rpi sends a specific time triggered message to the arduino. I've got the Rpi part figured out, i need help with the code for the arduino. Any help will be appreciated as i'm a complete newbie to the Arduino. Thanks in advance.

I can't help with the RPi side but the serial input basics tutorial might help you get the Arduino side working and give some advice on how to structure the data packets.

Just to clarify - I've got the Rpi side working... i just need to know how to get the arduino to print the sensor values to the serial port when the Pi sends the word 'update' to the duino.

Ebraheem_B:
Just to clarify - I've got the Rpi side working... i just need to know how to get the arduino to print the sensor values to the serial port when the Pi sends the word 'update' to the duino.

Have you tried the code in the link in Reply #1?

Things will be much simpler for the Arduino if the RPi just sends 'U' rather than 'update'

...R