Pages: 1 [2]   Go Down
Author Topic: using the tx and rx lines  (Read 2372 times)
0 Members and 1 Guest are viewing this topic.
Baltimore, MD
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok, I looked at your programs again and I am doing the same thing to get the same results.   >smiley-sad I tried extra reads, swapping logic on Chip Select and the only thing that caused more consistent results was slowing the clock rate down.  I don't have an oscilliscope (yet) but I wonder if the clock still runs when you aren't transmitting or have the SS_PIN selected.

One thing I did do was tried hooking both 3.3 and 5v up on their respective pins.  I tried the 3.3v first and it kept shutting down the Duemilnove (to much draw?).  It wasn't till after I tried the 5v that I noticed the note about not using both at the same time.  I hope I didn't blow some circuit on the SS5500.  I haven't yet put a continuity tester on my wiring to see if I accidently put a short in to the 3.3v while wiring up all the GND pins.

I'm going to try and switch to the Vout method just to get going on the project.  I may come back and revisit the UART and SPI methods later.  I guess my first attempt again with SPI should include a more powerfull 3.3v supply.

I really want to do SPI because my final project calls for this and an SPI display.  Theoretically you can use SPI bus like IC2 with a separate pin for each CS.  Each device is supposed to pass on the commands if CS isn't selected . . . like it is doing right now.  
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have tried to use pha555 version and can not get anything out of it think it must be wiring. looking at the code and the diagram I am confused.

This is what I did I use two analog inputs and output to a lcd.

This is my code if you can help build onto it let me know.

Thanks all,
Hugh smiley

/*
  Analog input, analog output, serial output
  Reads input pin A0 for temp from sensor and outputs degress f
  Reads input pin A1 for humidity from sensor and outputs in %
 
 Reads an analog input pin, maps the result to a range from 0 to 255
 and uses the result to set the pulsewidth modulation (PWM) of an output pin.
 Also prints the results to the serial monitor.
 
  The circuit:
 * Temp sensor output connected to analog pin 0.
   Humidity sensor output connected to analog pin 1
 * LED connected from digital pin 9 to ground
   LCD connections reset connected to digital pin 12
                   enable = D11
                   DB4 =  D5
                   DB5 =  D4
                   DB6 =  D3
                   DB7 =  D2
 
 created 7 Oct 2010
 Modified  7 Oct 2010
 by Hugh Coleman
 
 This example code is in the public domain.
 
 */
 
 // include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);


// These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0;  // Analog input on pin A0 for temp reading
const int analogOutPin = 9; // Analog output pin that the LED is attached to
const int analogInPinOne = A1; // Analog input pin A1 for humidity reading

int tempValue = 0;        // value read from sensor output
int outputValue = 0;        // value output to the PWM (analog out)
int humidValue = 0;
int OutPutValueOne = 0;

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.clear();
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);

}

void loop() {
  // read the analog in value:
  tempValue = analogRead(analogInPin);   //reads the value on analog pin a0:
  humidValue = analogRead(analogInPinOne); //reads the value on analog pin a1
  
  // map it to the range of the analog out:
  outputValue = map(tempValue, 0, 1023, 0, 255);

  // change the analog out value:
  analogWrite(analogOutPin, outputValue);          

  // print the results to the serial monitor:
  Serial.print("sensor = " );                      
  Serial.print(tempValue);
  
  //           sets the cursor and prints Temp:
      lcd.setCursor(2,0);
      lcd.print("Temp");    //outputs Temp to lcd:
    
  //            sets the cursor and prints the current temp in F:
      lcd.setCursor(11, 0);
      lcd.print(tempValue*.155);  //calls the tempValue multiplies it times .155:
  
  //           sets the cursor and prints Humidity:
      lcd.setCursor(0, 1);
      lcd.print("Humidity");  //outputs Humidity to lcd:
  
  //            sets the cursor and prints the current relative humidity:
      lcd.setCursor(11, 1);
      lcd.print(humidValue/10);  //analog a1 input divided by 10:
      
 //             sets the cursor and prints the % sign    
      lcd.setCursor(14, 1);
      lcd.print("%");
      
      
 //    delay 3 seconds:      
          delay(3000);
          
          
          Serial.print("\t output = ");
          lcd.clear();                      
          Serial.println(outputValue);  
  

                    
}
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I also tried the code from pha. No success.
I got something like T_F = -5061 RH = -5061
Logged

Pages: 1 [2]   Go Up
Jump to: