I'm sorry for the late reply. I really appreciate your reply.
I've read all your replies.
When I read Paul_B's answer, I understood that both ends of the variable resistance are in a position where the resistance does not change, so the values will be the same.
So I'm going to map from 0 to 1023, and then I'm going to hand turn the variable resistance to where the resistance changes, and then I'm going to measure the rotation angle of the step motor.
Or should the code be modified to measure the rotation angle of the step motor after the variable resistance has passed a certain angle?
I'm currently building an astrophilic tracker. The angle of the step motor is reversed by the angle at which the earth rotates. Earth's Rotation Visualized in a Timelapse of the Milky Way Galaxy - 4K - YouTube, please refer to the video at this address. My step motor rotates an angle of 0.088 per pulse and has an angle of 4096. We're going to use a step motor and an RTC module to rotate it 15 degrees for an hour to assemble it.
The RTC module was used to code 0.088 degrees every 21 seconds. But even after 10 hours, you have to make sure it's spinning properly.(Of course there are errors, but it's okay if it's not serious.) So we're measuring the rotation angle of the step motors using variable resistance.
I read Dave's answer.
Rotate the variable resistance between 0 and 270 degrees and 0 degrees multiple times to put the figure into the Excel graph. If so, it is appropriate.Did I get it right?
rtc.halt(false);
rtc.writeProtect(false);
Alarm.timerRepeat(21, Repeats); // 반복 타이머
/* Time setting === */
// rtc.setDOW(MONDAY);
// rtc.setTime(15, 23, 00);
// rtc.setDate(06, 04, 2020);
}
//////////////////////////////////////////////////////////////////////////////
void loop(){
unsigned int val = analogRead(A0);
unsigned int value;
Serial.print(" 요일 : ");
Serial.print(rtc.getDOWStr());
Serial.print(" ");
Serial.print(" 날짜 : ");
Serial.print(rtc.getDateStr());
Serial.print(" ");
Serial.print(" 시간 : ");
Serial.print(rtc.getTimeStr());
Serial.print(" / ");
Alarm.delay(1);
Serial.print("맵핑된 value의 각도는 : ");
Serial.println(value); // Variable resistance value
}
//==================================================//
void Repeats(){ // Timer function
stepper(1);
i++;
// Serial.print(" 스텝모터의 진행 된 펄스 : ");
Serial.print(" / ");
Serial.println(i); // stepper moter pulse
}
Thanks for reading it !!!