Adafruit coding issue for simple Frequency gen

Hey guys!!

So I know I did finish the last version, that works great but I realized I get what to much interference near my Tesla Coil. So I needed to remake a very simple version of that to use on a Adafruit 5v trinket. the problem I have is unknown, This code works fine with any standard Arduino, Its something in my code that Adafruit doesnt see or realize. One thing that help was getting rid of any "unsigned long" variables, that through it off a bit. So as this code sits I can change the frequency just fine but the DutyIn potentiometer does nothing, not sure if its my math or what but everything works on any Arduino just not Adafruit??. Any help would be great thanks.

int Duty = 0;
float Freq = 0;
int FreqIn = 0;
int DutyIn = 0;
float offtime = 0;
float ontime = 0;
int outPin = 0;  // PhysicalPin 5
int ledPin = 1;
float Period;
void setup() {
  // put your setup code here, to run once:
  pinMode(outPin, OUTPUT); 
  pinMode(ledPin, OUTPUT);
}

void loop() {
  FreqIn = analogRead(PB3);
  DutyIn = analogRead(PB4);


  
 Period = map(FreqIn,0,1023,0,6000);
  Period = constrain(Period,0,6000);
  Duty = map(DutyIn,0,1023,0,1000);
  Duty = constrain(Duty,0,1000);
  
  offtime = Duty*.001;
  offtime = offtime*Period;
  ontime = Period - offtime;
  ontime = constrain(ontime,0,10000);
  
     digitalWrite(outPin, HIGH);     // On
     digitalWrite(ledPin, HIGH);     // On
     delayMicroseconds(ontime);      // delay in us
        
     digitalWrite(outPin, LOW);      // Off
     digitalWrite(ledPin, LOW);      // Off
     delay(offtime);                 // delay in ms
  }

What the hell are you talking about? Was this supposed to be part of some other thread or something? What code? What adafruit product?

Thats was for anyone that read my last post, ignore that. The code I forgot, I tried to edit right away and it yelled at me for trying to post twice in 5mins. and I did mention the product, Adafruit 5v Trinket.

I have now found that its a problem with my PB2 and PB4 inputs, both those pins will not read an analog input although they should. I tried 3 different Adafruit boards all do the same, this is why I think a code error. my PB3 will analog read but thats the only one.??lost???

Okay I figured it out!!!

digitalWrite(outPin, HIGH); // On digitalWrite(ledPin, HIGH); // On delayMicroseconds(ontime); // delay in us

digitalWrite(outPin, LOW); // Off digitalWrite(ledPin, LOW); // Off delay(offtime); // delay in ms

I was delaying mircos on one and millis on the other, that prevented me from seeing another issue. On the Adafruit site it shows PB2 = pin 2, PB3 = pin3, PB4 = pin4.....well not the case here??? My PB2 goes to pin 4 WTF!!! ehhh w/e it works now!!