Skip to content

Instantly share code, notes, and snippets.

@BlvckBytes
Created November 20, 2025 13:26
Show Gist options
  • Select an option

  • Save BlvckBytes/a6e3f199bd4c614fbb1f27a9b87d5ab1 to your computer and use it in GitHub Desktop.

Select an option

Save BlvckBytes/a6e3f199bd4c614fbb1f27a9b87d5ab1 to your computer and use it in GitHub Desktop.
Simple symmetric-duty-time H-bridge with dead-time, ideal for cheap ATTinys as a substitution for the corresponding ASIC
#define BRIDGE_A_PIN 3
#define BRIDGE_B_PIN 4
#define ON_TIME_US 2000
#define DEAD_TIME_US 100
void setup() {
pinMode(BRIDGE_A_PIN, OUTPUT);
digitalWrite(BRIDGE_A_PIN, LOW);
pinMode(BRIDGE_B_PIN, OUTPUT);
digitalWrite(BRIDGE_B_PIN, LOW);
}
void loop() {
digitalWrite(BRIDGE_A_PIN, HIGH);
delayMicroseconds(ON_TIME_US);
digitalWrite(BRIDGE_A_PIN, LOW);
delayMicroseconds(DEAD_TIME_US);
digitalWrite(BRIDGE_B_PIN, HIGH);
delayMicroseconds(ON_TIME_US);
digitalWrite(BRIDGE_B_PIN, LOW);
delayMicroseconds(DEAD_TIME_US);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment