Recognize Arduino conneccted to the PC


hi everyone, have implemented system move servo using fingerprint. have saved fingers in database using software:
https://startingelectronics.org/articles/gt-511c3-sdk-demo-arduino-uno/

and writing in arduino code:


code: [select]

#include <softwareserial.h>
// need serial port communicate gt-511c3
softwareserial gtserial(8, 7); // arduino rx (gt tx), arduino tx (gt rx)
// arduino tx pin needs voltage divider, see wiring diagram at:
// http://startingelectronics.com/articles/gt-511c3-fingerprint-scanner-hardware/
void setup() {
  serial.begin(9600);    // serial connection processing app.
  gtserial.begin(9600);  // communicating gt-511c3
}
byte rx_byte = 0;        // stores received byte
void loop() {
  if (serial.available()) {
    // byte processing app. , send fps
    rx_byte = serial.read();
    gtserial.write(rx_byte);
  }
  // check byte gt-511c3
  if (gtserial.available()) {
    // byte fps , send processing app.
    rx_byte = gtserial.read();
    serial.write(rx_byte);
  }
}



and have used code move servo after fingerprint recognize finger:
code: [select]

#include "fps_gt511c3.h"
#include "softwareserial.h" // usata dalla fps_gt511c3.h
#include "arduino.h"
#include "servo.h"

servo myservo;  // create servo object control servo
int pos = 0;    // variable store servo position
fps_gt511c3 fps(8, 7);

void setup() {
  // put setup code here, run once:

    serial.begin(9600);
  delay(100);
  fps.open();
  fps.setled(true);
    myservo.attach(9);  // attaches servo on pin 9 servo object
}

void loop()
{
  // put main code here, run repeatedly:
  if((fps.ispressfinger()) == true)
  {

    fps.capturefinger (true);         // cattura l'impronta del dito sul sensore e la memorizza nella memoria del sensore stesso. andrà poi confrontata con il db per individuare l'id. restituisce true se la cattura ha successo, false se il sensore è vuoto.
      if (fps.verify1_1(0) == 0 || fps.verify1_1(1) == 0 || fps.verify1_1(2)== 0 || fps.verify1_1(3)== 0 || fps.verify1_1(4)== 0 || fps.verify1_1(5)== 0 || fps.verify1_1(6)== 0 || fps.verify1_1(7)== 0 || fps.verify1_1(8)== 0 || fps.verify1_1(9)== 0 || fps.verify1_1(10)== 0 || fps.verify1_1(11)== 0 || fps.verify1_1(12)== 0 || fps.verify1_1(13)== 0 || fps.verify1_1(14)== 0 || fps.verify1_1(15)== 0 || fps.verify1_1(16)== 0 || fps.verify1_1(17)== 0 || fps.verify1_1(18)== 0 || fps.verify1_1(19)== 0)
      // int verify1_1(int id): verifica se l'impronta catturata con la funzione capturefinger corrisponde all'impronta memorizzata nello slot identificato da id (da 0 199). ritorna: 0 se corrispondono, 1 se la posizione non è valida (id < 0 o id > 199), 2 se l'id non in uso (vuoto), 3 se l'impronta non corrisponde quella nello slot id
      {

        pos =0;
        myservo.write(pos);              // motore in posizione 0 gradi
        delay (2000);            
        }
  
             pos =75;
              myservo.write(pos);              // motore in posizione 75 gradi
              delay (500);        
  }
          
}



now want use single arduino software bough things. how can recognize if arduino connected usb or not? there functions? have conflict?

thanks in advice.

please tools > auto format on code before posting it. make easier spot bugs , make easier read.

please remove unnecessary blank lines code before posting forum. 1 or 2 separate code logical sections fine large spaces no reason make more scrolling when we're trying read code.

which arduino board using?


Arduino Forum > Using Arduino > Programming Questions > Recognize Arduino conneccted to the PC


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts