counting system based on arduino and ms excel

I am doing this project:

I have 1 input. This is a push button, connected to an arduino mega 2560. The arduino is connected to the computer via usb cable.

The push button is connected to the PWM input of the arduino mega2560.

Each time the push button is pressed, the press of a push button is recognised as a HIGH. In its normal unpressed state it is LOW.

Then using serial.println i will transfer this to the computer, through serial communication via usb cable.

Along with this, i implement a count for each button. Each time a push button is pressed, the count that is assigned to that push button, increments by 1.

This is displayed on the serial monitor.

Below, is the arduino code:

int current_state=LOW;
int last_state=LOW;
int count_1=0;
int pushbutton_1=2;

void setup(){
 
Serial.begin(9600);

pinMode(pushbutton_1, INPUT);
current_state=digitalRead(pushbutton_1);

}

void loop(){

current_state=digitalRead(pushbutton_1);

if (current_state==HIGH && last_state==LOW){
count_1++;
Serial.println(count_1);

}

last_state=current_state;


}

The arduino code does the needful.

My problem is how do i transfer the data that is arriving through serial, to an excel sheet.
The excel sheet/database should display a count for the pushbutton.
Each time a push button is pressed, the count that is assigned to that push button, should increment by 1.
This count should be incremented and updated in the excel sheet.

I think it might depend on the version of Excel you are using but you can do this with PLX-DAQ. This effectively turns Excel into a terminal. This works fine with Office 97 and 2000 but I don't know what others. I don't see the point of the code, but serial data is what you want. If you need to date/timestamp the data, that can be done at the Excel end, using the PC clock.

Thank you Nick_Pyner. If i am to do this without using a microcontroller, by using the flow control lines on a serial port to read the pushbuttons. Then, can i use plx daq to transfer data from serial port to ms excel ?

DB9-SW-300x198.png

Quite possibly.

It wouldn't cost much to test it. The first step is to check that your PC will recognise that stuff as a serial device. The next is to ensure that closing the switch is an intelligible signal for Excel.

I imagine it would be a lot simpler to come good with the $12, and get a Uno.

At the moment plx daq is receiving the data from arduino, but it is not displaying it

That's novel. How do you know it's receiving the data?