Go Down

Topic: arduino+vb6 (Read 10298 times) previous topic - next topic

majdi_mohammad

For the arduino program load this to your hardware :

Try used ide2.2 version i dont know either it work with ino1.0 version

//----------------------------------------------------------------------------

int kaki[9]= {-1,2,3,4,5,6,7,8,9};
int baca[9]={0,0,0,0,0,0,0,0,0};

void setup() {
  Serial.begin(9600);
  for (int i = 1; i <= 8; i++) {
    pinMode(kaki, INPUT);
  }
}

void loop() {
  for (int i = 1; i <= 8; i++) {
    baca=digitalRead(kaki);
    Serial.print(baca,BYTE);
  }
    delay(100);
}


//-------------------------------------------------------------------------------

And the hardware setup is like this :


majdi_mohammad

To check what comport number your arduino is :

I assume you install all the driver needed and can used arduino.

Right click my computer select > properties > devices manager

now plugin usb cable to your arduino

look at Device Manage > Port (COM&LPT) it will show your arduino comport number.
*Take note the comport number and replace on vb 6 source code.

Glennmars

thank you so much for your reply majdi_mohammad.. :smiley-surprise:
i'll try this when the time i come home...
but before anything else, this code you posted the inputs are 8 supposedly it's only 4 because the other 4 are just an indicator of the first 4 if it works ( base on the arduino only)..well, again i'll try this.. :%



majdi_mohammad

The code that i post will be:

8 pushbutton on arduino

when push the push button on arduino:

In vb6 will be change to red colour.

* I dont get how you want it be? maybe you can explain in detail how it will be? ;)

Glennmars

hello,
it's been a long time..by the way, i try your code for the arduino but when i use to compile this, there is an error occur in this code:
Code: [Select]

pinMode(kaki, INPUT)

which means invalid conversion from int* to 'unit8_t'..what does it mean?..

i used  the arduino version 0021

..thanks for keeping in touch.. ;)

retrolefty


hello,
it's been a long time..by the way, i try your code for the arduino but when i use to compile this, there is an error occur in this code:
Code: [Select]

pinMode(kaki, INPUT)

which means invalid conversion from int* to 'unit8_t'..what does it mean?..

i used  the arduino version 0021

..thanks for keeping in touch.. ;)

Code: [Select]

change pinMode(kaki, INPUT) to pinMode(kaki[i], INPUT)





Glennmars

hello majdi_mohammad, i just want your help on doing that below..i find hard to do this in vb because i there are many textboxes..
Quote

Create a new project and use the code below you need a put a label called (label1)and caption it "Com Port Number. add a communication object named (MSComm1). Put in a text box called
(ComPort). Add another longer text box called (text1). add a command button called (Command1)change the caption to "find com port". now add another text box called (text1).
Next add a shape object called (Shape1)
compile and run the code. Put the number of the com port into the text box called ComPort... just type in "1". click the command button and the other text box should show the pressure and the shape object should change colors.


Thanks!

Glennmars

hello retrolefty!

i change the code just like what you've suggested and yet it's okay but another thing appears as an error in this code:
Quote

Code: [Select]

baca=digitalRead(kaki);

that means invalid conversion from int* to 'unit8_t'.

PaulS

Quote
but another thing appears as an error in this code:

So, look at that that code is doing. It is trying to read from an array of pins, when it is designed to read from a pin. The function is not designed to take an array of pins, so the compiler is telling you that.

Go Up