top of page
  • Writer's pictureAllison Chan

Week 3 - Firmware Implementation

Great progress on firmware this week! We got the motors and solenoid firmware done. Most of the GCode commands are functioning except everything related to docking sequence, which is next week's goal.


The main idea to run the motor is to send a pulse for a step. The pulse width controls the speed of the motor.

void StepperMotor::rotate(float deg){
 uint32_t steps = floor(abs(deg)/conversion_factor);
 digitalWrite(dir_pin, deg > 0);
 for(int x = 0; x < steps; x++) {
  pulse(half_pulse_width);
 }
}

For the solenoid, simply sending a voltage to the pin activates it. Since one of the GCode commands is to dispense liquid based on weight and the load cell is not with the board, a dummy method was implemented:

float LoadCell::read(){
  // to be implemented, can remove val after
 val++;
 Serial.println(val);
 return val / conversion_factor;
}


2 views0 comments

Recent Posts

See All
Post: Blog2_Post
bottom of page