Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

counter for arduino

Status
Not open for further replies.

henrymonkey

New Member
hello, im sort of new to ardunio. I am asking for links or info about using 2 inputs to arduino. I have a 14 count sample into the arduino, 1`5 volt analog in ,, can get it to read to pc via usb. but looking for refrence to be able to progam a counter along with the input? i.e sample 1=3v pc read 3 v.. want a counter to read on pc that say sample 1. can anyone direct me to programing info that can help me make my pc count the samples? thank you in advance Henry.
 
Hi,

So you have one analog and one digital input that you want to display on the computer PC then?
What 'sketch' are you using now?
 
just using the analog in sample sketch, it reads an analog voltage and prints it to pc, want to use same analog in but by way of external switching change the analog in voltage to that pin. ..is there a way to make the arduino count the readings...swithch1 is 4.5 volt... 2 switch has 2.3 votl... 3 switch has 4.1 volt.. thry are are all going to same analog in pin but is there a way to multitask the arduino to be able to read a count that is coming into the analog in pin.? ie an anlog sample ..relates to switch 1..2..3 and print that beside the voltage reading coming from analog in pin,, can you direct me to a refrence to learn more about programming arduino... also I have external clocking of the switches.. can the arduino also generate a clock pulse to trigger switching whaile doing the other read task? I need to go to arduino school?
 
I think this is more of what your trying to do here this maps the adc to 14 values.
set a pot center wiper on A0 and ground one end and put the top to Vdd
run the serial monitor and you'll see it has 14 ranges which could be a r to r button setup for 14 buttons
Code:
int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out) don't need this but it lets you 
//use a led to see whats going on too.

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);         
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 14);
  // change the analog out value:
  analogWrite(analogOutPin, outputValue);        

  // print the results to the serial monitor:
  Serial.print("sensor = " );                    
  Serial.print(sensorValue);   
  Serial.print("\t output = ");   
  Serial.println(outputValue);

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(2);                  
}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top