I have compiled and uploaded my code to the Arduino Micro using COM5 and it uploads the file but now that I press on Serial Monitor and want to see the results, it says: "Serial 'COM5' not found. Did you select the right one from the tools > Serial Port menu" ? .
Following is my code, I just tested another code and that one is working fine. Perhaps there is something wrong with this code?
#define icpPin 8 // this interrupt handler must use pin 8
volatile unsigned int Pulses[2000]; // array holding number of ticks
volatile uint8_t over_flow_count;
volatile uint8_t PulseCount; // number of pulses received in current frame
ISR(TIMER1_CAPT_vect)
{
//Serial.println("Hello");
if(bit_is_set(TCCR1B ,ICES1)==0) // If rising edge is detected
{
TCNT1 = 0; // reset the counter - 16 bit counter
Pulses[PulseCount++] = ICR1;
Serial.print("Overflow=");
Serial.println(over_flow_count);
Serial.println("count=");
Serial.print(Pulses[PulseCount]);
}
}
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
pinMode(icpPin,INPUT);
PulseCount = 0;
over_flow_count=0;
TCCR1A = 0x00;
TCCR1B = 0x01;
TIMSK1 = _BV(ICIE1); // enable input capture interrupt for timer 1
}
void loop() // run over and over again
{
if (ICR1==65536)
{
over_flow_count=over_flow_count+1;
}
}
Moderator edit: </mark> <mark>[code]</mark> <mark>
smd_10:
Aruino Micro. It is simple interrupt counter. The funny thing is that with the same code it was working an hour ago.
That chip has no seprate USB to serial chip it is done by processor. When you press the reset it takes time to establish the USB HID serial emulator and you HAVE NOT aloud for this in your code. There needs to be a while ( !Serial ) { } in your setup like it said in the instructions to this board and the Learnardo.
I have compiled and uploaded my code to the Arduino Micro using COM5 and it uploads the file but now that I press on Serial Monitor and want to see the results, it says: "Serial 'COM5' not found. Did you select the right one from the tools > Serial Port menu" ? .
Any idea what is the possible problem.
Regards,
Is the com5 being used by another instance of the arduino IDE you've started?