Pages: [1]   Go Down
Author Topic: Grove starter kit  (Read 488 times)
0 Members and 1 Guest are viewing this topic.
Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 559
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I have a grove starter kit and I am trying to get a reading from the tilt sensor and display it on the screen. I made a program, but when I turn the sensor the display filters threw what seems like all the possible symbols that it is capable of displaying. Obviously, the reading should only be numbers. Any help would be appreciated.

Thanks,
Drew Davis

Link:

http://www.seeedstudio.com/depot/grove-starter-kit-p-709.html


My code…

#include <SerialLCD.h>
#if ARDUINO < 100
#include <NewSoftSerial.h>
#else
#include <SoftwareSerial.h>
#endif
int sensorPin = A0;


SerialLCD slcd(11,12);

void setup() {

  slcd.begin();

 
}

void loop() {
 

  slcd.setCursor(0, 1);
  slcd.print(analogRead(sensorPin));
  delay(50);
}



Logged

Ontario, Ohio
Offline Offline
Full Member
***
Karma: 1
Posts: 208
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
void setup()
{
 Serial.begin(9600); 
}
Maybe this is what you need to add? This sets the data rate so that you can communicate with your computer through the serial monitor.
 
According to the description on the link, the tilt switch should be read like a button (digital input). It says that when the switch is level, the button is open, and when it is tilted, the switch closes. Why are you including serial libraries? Get rid of them and try this:
http://arduino.cc/en/Tutorial/Button Just use the tilt switch as the button. Did you read this link provided on the main page of the link you provided? http://www.seeedstudio.com/wiki/index.php?title=GROVE_-_Starter_Kit_v1.1b#Grove_-_Tilt_switch
It walks you right through set up and a simple example project including the code.

You have started threads all over the place covering various subjects in a very short period of time. You will learn much more, be more successful, and be much much happier and satisfied in the long run if you do one thing at a time. In just a few days you have started threads and asked for help about this tilt sensor, motor drivers, ultrasonic sensors, servos, joysticks, serial lcd's, and photo resistors. This tilt sensor would be a good project to start with, but read and watch some arduino and electronics tutorials. I gave you a couple good links in another thread, or you can find some others. Start out slow and experiment.

When posting code, use the code tag tool. You can just highlight the code that you pasted and hit the '#' key much like you do when you post a link.

Good luck
« Last Edit: November 03, 2012, 07:03:20 am by TeslaIaint » Logged

Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 559
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you!
Logged

Pages: [1]   Go Up
Jump to: