Sine oscillator and LCD

Hello!

My name is Claudiu and I am new to arduino. If this subject was commented on another topic, I am very sorry and I would appreciate redirection.

So, this is what my project is about. I have a Chip kit max 32 prototyping board, Arduino compatible. I would like to output some frequencies on a pin, for a few seconde, and display the frequency on a 16x2 LCD (which I have tested and it is ok). For example:

100hz for 5 seconds
1khz for 5 seconds
10khz for 5 seconds..... Etc. (sine wave)

Everything on the same pin.
On the 16x2 LCD I would like to display the frequency on the first row and the time remaining on the second row (like 5, 4, 3...).

I managed to get some frequency on pin 13 and to display some information on the LCD, but when I try to combine the two codes...just error.

Thank you very much and I would be appreciative for any kind of help.

You can't get sin waves out of a single digital pin.
You can get PWM signals out of some pins which you can smooth with a filter but they are not very good.

but when I try to combine the two codes...just error.

See this:-
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

Thank ou very much. But what if I would want Dreptunghiular wave? Would that be easier? I am sorry but I do not know the english term for that waveform. It is not sine and not triangle. The other one!

But what if I would want Dreptunghiular wave

Google translate says this is rectangular, yes that is much simpler. See the tone() function of the arduino.

Ok. Tomorrow i will try at the university and i will get back to you.

Hello!

I tried implementing tune() function and it worked. This is the actual code:

/*


// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("100Hz ");
  tone(6, 100, 5000);
  delay(5000);
  
  lcd.print("1K ");
  tone(6,1000,5000);
  delay(5000);
  
  lcd.print("5K ");
  tone(6,5000,5000);
  delay(5000);
  
  lcd.print("10K");
  tone(6,10000,5000);
  delay(5000);
  
  lcd.setCursor(0, 1);
  lcd.print("20K");
  
  //lcd.print("5.");
  tone(6,20000,5000);
  delay(5000);
  
}


void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(4, 1);
  // print the number of seconds since reset:
  lcd.print("Terminat");
}

Moderator edit: quote tags exchanged for code tags

I output the 5 frequencies on pin number 6 (7-12 are busy with the LCD). Pin 6 is connected to a simple Wheatstone bridge, which measures the resistance of the human body (whith two electrodes placed on the skin). I measure the output of the bridge with an oscilloscope or with a multimeter set on AC. I would like to do this measurements with the Arduino itself, using other pin as input. Is that possible/difficult? I read that you cannot read anything with your Arduino while using the delay() function. So, as pin 6 outputs a certain frequency, I would like the Arduino to read a certain AC voltage and, eventually, write it in a text file.

I would be appreciative for any sugestions.

Thank you!

Is that possible/difficult?

It is difficult. How much voltage are you measuring?

I read that you cannot read anything with your Arduino while using the delay() function

No that is just rubbish, you must have miss read it.

I would like the Arduino to read a certain AC voltage

It can only read DC, to get it to read AC you have to rectify and smooth the signal, but as 0 to 5V gets mapped over 1024 steps the smallest step is 4.8mV, this might be too big for you.

and, eventually, write it in a text file.

Where is this text file, the arduino doesn't have a filing system. You can add an SD card and write it to that or you can send it over the serial port and have an application on the computer save it into a file.

Between 0 and 4 V AC.

4.8 mV is not too big, it is actually perfect. I do not intend to use an SD card for now, it seems too complicated and I am just trying to make a prototype working. Hard disk storage is fine with me, using the USB port provided by the chip kit max 32 board. Could you please help me or give me some hints in ac data logging using Arduino?

using the USB port provided by the chip kit max 32 board.

This is not an arduino. So:-

give me some hints in ac data logging using Arduino?

This is a bit meaningless.

This is a forum for Arduino, not Arduino like rip offs.

Ok, thanks anyway. Chipkit max 32 is fully compatible with Arduino and I hoped I could find some answers on this forum, since it can be used as an Arduino.

Here you can find a link about it. http://www.digilentinc.com/Products/Detail.cfm?Prod=CHIPKIT-MAX32.

Chipkit max 32 is fully compatible with Arduino

Look at your link again. It's hardware is compatible with the Arduino, which means that you can plug a shield designed for the Arduino into a Chipkit.

The Chipkit uses a PIC microcontroller instead of an ATmega microcontroller and their native (assembly) language is different. Although much of the C code written for one can probably be adapted for the other they are not fully compatible.

Don

Chipkit max 32 is fully compatible with Arduino

No see above.

and I hoped I could find some answers on this forum, since it can be used as an Arduino.

If it has a

Hard disk storage is fine with me, using the USB port provided by the chip kit max 32 board

That you can use as a hard drive the this is a USB host and is nothing the arduino can cope with.

Ok, I will read more about it. Thanks!