Help for Rotary Encoder + DS18B20

:~ Help i have project for read Rotary Encoder counter and read also temprature from DS18B20.
i newbie here please help me i possible to read 2 of them on the same time? and i can get both from my VB6...

You need to research your project. We're here to help you when you get stuck. You have to get the ball rolling by googling your topic.
Everything you need is out there.
Your move

BTW,
I don't know anything about VB6 so you might want to google arduino/VB6 interface or post in Interfacing with Software Topic section for that issue ONLY . (DO NOT MENTION THE ENCODER OR DS18B20 IN THAT POST)

Before you dive into that coding, have you any Arduino experience yet? You should at least have worked through most of the examples part 1, 2 and 3.

While I agree totally with raschemmel about researching your project, to save you a few microseconds of Googling, here is something that should get you started with the encoder. But you need to find and digest the datasheet for your encoder....

You should at least have worked through most of the examples part 1, 2 and 3.

yeah, and there's that...

Yes I learn about 3 week ago.
Okay about VB6 forget it. i have sketch that my encoder its doing well for rps and rpm and counter
but if i add one DS18B20 sensor for temprature, each time I run my encoder then my temp just show up
and each time i stopped my encd my rpm and rps remain show my last number and not zero

here my sketch

#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 3
 

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);


const int encoderPinA = 4;
const int encoderPinB = 2;
const int ledPin = 9;
const int encoderStepsPerRevolution=500;
int angle = 0, milisegundos= 1000;
long last = 0;
int val, contar=0, rpm2;
float encoderPos = 0;
char encoderPos2[10], temp1[10];

boolean encoderALast = LOW;  // remembers the previous pin state


void setup()
{
  pinMode(encoderPinA, INPUT);
  pinMode(encoderPinB, INPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(encoderPinA, HIGH);
  digitalWrite(encoderPinB, HIGH);

  Serial.begin (115200);
  // Start up the library
  sensors.begin(); 
}

void loop()
{
  boolean encoderA = digitalRead(encoderPinA);
     
  

  if ((encoderALast == HIGH) && (encoderA == LOW))
  {
    if (digitalRead(encoderPinB) == LOW)
    {
      encoderPos--;
      digitalWrite(ledPin, HIGH);
    }
    else
    {
      encoderPos++;
      digitalWrite(ledPin, LOW);
 
    }
    //angle=(encoderPos % encoderStepsPerRevolution)*360/encoderStepsPerRevolution;
//    Serial.println (encoderPos);
    contar++;


    if(millis()-last>=milisegundos){
     double rps=((double)contar)*1000.0/milisegundos;
//   double rpm=((double)contar)*60000.0/(milisegundos);
     double rpm = (rps/500) * 60;
     dtostrf(encoderPos,1,0,encoderPos2);
     dtostrf(sensors.getTempCByIndex(0),1,2,temp1); 

     sensors.requestTemperatures(); // Send command buat dapat temp
     Serial.print(encoderPos2);
     Serial.print("@");
     Serial.print(rps);Serial.print("#");
     Serial.print( rpm);
     Serial.print("$");
     Serial.println(temp1);
     Serial.println();  
     Serial.flush();
     contar=0;
     last=millis();
   }
     
  }

  encoderALast = encoderA;
}

and here my result

counter@RPS#RPM$TEMP

542@542.00#65.04$23.00

1336@794.00#95.28$23.00

2214@878.00#105.36$23.00

3044@830.00#99.60$23.00

3868@824.00#98.88$23.00

4691@823.00#98.76$23.00

5419@728.00#87.36$23.00

reason i use char @,#,$ its for separator so ican split in visual basic using len, mid

read the rotary encoder page the answers in there. put your code in brackets read the read before posting and do what the experienced people say they only post on what they know works

so this my app

 #include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 3
 

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);


const int encoderPinA = 4;
const int encoderPinB = 2;
const int ledPin = 9;
const int encoderStepsPerRevolution=500;
int angle = 0, milisegundos= 1000;
long last = 0;
int val, contar=0, rpm2;
float encoderPos = 0;
char encoderPos2[10], temp1[10];

boolean encoderALast = LOW;  // remembers the previous pin state


void setup()
{
  pinMode(encoderPinA, INPUT);
  pinMode(encoderPinB, INPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(encoderPinA, HIGH);
  digitalWrite(encoderPinB, HIGH);

  Serial.begin (115200);
  // Start up the library
  sensors.begin(); 
}

void loop()
{
  boolean encoderA = digitalRead(encoderPinA);
     
  

  if ((encoderALast == HIGH) && (encoderA == LOW))
  {
    if (digitalRead(encoderPinB) == LOW)
    {
      encoderPos--;
      digitalWrite(ledPin, HIGH);
    }
    else
    {
      encoderPos++;
      digitalWrite(ledPin, LOW);
 
    }
    //angle=(encoderPos % encoderStepsPerRevolution)*360/encoderStepsPerRevolution;
//    Serial.println (encoderPos);
    contar++;


    if(millis()-last>=milisegundos){
     double rps=((double)contar)*1000.0/milisegundos;
//   double rpm=((double)contar)*60000.0/(milisegundos);
     double rpm = (rps/500) * 60;
     dtostrf(encoderPos,1,0,encoderPos2);
     dtostrf(sensors.getTempCByIndex(0),1,2,temp1); 

     sensors.requestTemperatures(); // Send command buat dapat temp
     Serial.print(encoderPos2);
     Serial.print("@");
     Serial.print(rps);Serial.print("#");
     Serial.print( rpm);
     Serial.print("$");
     Serial.println(temp1);
     Serial.println();  
     Serial.flush();
     contar=0;
     last=millis();
   }
     
  }

  encoderALast = encoderA;
}

click the MODIFY button in the upper right of the post window.
Highlight all your code.
click the "#" CODE TAGS button on the toolbar above just to the left of the QUOTE button.
click SAVE (at the bottom).
When you post code on the forum, please make a habit of using the code tags "#" button.

Not sure what is causing that issue.

click the MODIFY button in the upper right of the post window.
Highlight all you code.
click the "#" CODE TAGS button on the toolbar above just to the left of the QUOTE button.
click SAVE (at the bottom).
When you post code on the forum, please make a habit of using the code tags "#" button.

You aren't quoting anything here, you are making a statement that you want to emphasize.

click the MODIFY button in the upper right of the post window.
remove the QUOTE TAGS that were inserted when you used the quote button earlier
highlight the stuff you want to emphasize
click the 'v' to the right of the [Change Color] box
select the color you want - blue is good
click SAVE (at the bottom).
when you are not quoting something from earlier in the thread please refrain from using quote tags

Don

Sorry for my mistake, i just need all of you take a look my sketch if there any suggest for my problem