I am getting "forbiden" message when I try to connect to it. It worked fine earlier today.
Ray On Aug 26, 2015 12:50 AM, "Marius Liebenberg" <mar...@mastercut.co.za> wrote: > I changed the input spindle frequency to 200Hz and fixed the scaling. > The input frequency is given and not calculated as it wastes unnecessary > time. It works very well now. I will use a fast opto coupler to drive > the power source and hopefully I have a solution. > > #define MainPeriod 50 // measurement frame duration, milliseconds > #define pulseInput 2 // input pin for pulseIn > #define pulseOutput 4 > > long previousMillis = 0; > unsigned long duration = 0; // receive pulse width > unsigned long outDuration = 0; > long pulsecount = 0; > long dc = 0; > > float Freq = 0.2e3; > float T = 1 / Freq; > void setup() > { > pinMode(pulseInput, INPUT); > Serial.begin(19200); > pinMode(ledPin, OUTPUT); > analogWriteFrequency(4, 40000); //set the pwm frequency = 25usec > analogWriteResolution(10); // use the highest resolution > } > > void loop() > { > unsigned long currentMillis = millis(); > if (currentMillis - previousMillis >= MainPeriod) > { > previousMillis = currentMillis; > dc = (duration / 5e-3)/1000; > dc = dc / 100; > outDuration = (dc * 1024)/100; > analogWrite(pulseOutput, outDuration); > > // write current time and F values to the serial port > // not implimented for production but handy to see the frequencies > > //Serial.print(currentMillis); > //Serial.print(" "); // separator! > > /*Serial.print(dc); > Serial.print(" "); > Serial.print(pulsecount); > Serial.print(" "); > Serial.print(duration); > Serial.print(" "); > Serial.println(outDuration);*/ > > duration = 0; > pulsecount = 0; > > } > // instead of single measurement per cycle - accumulate and average > duration += pulseIn(pulseInput, HIGH, MainPeriod * 900); > pulsecount++; > > } > > > > >On 25.08.15 14:27, Marius Liebenberg wrote: > >> Erik > >> I am getting to old to be a purist any more. I always use the > >>platform > >> or chip with the best or most intuitive dev environment. > >> Short piece of code using a Teensy 3.0. I use the Visual Micro > >>debugger > >> in Microsoft Visual Studio 2015 all running on the latest Arduino > >> environment. > > > ><Chuckle>. Marius, I've feared I'm too old to learn the newfangled > >Arduino environment, so I'm thrilled to see how you've leveraged it. > >The speed of getting it going is very impressive. I should take a > >closer > >look at the environment - I think I've seen somewhere that it can be > >used with the gnu toolchain. > > > >Erik > > > > >------------------------------------------------------------------------------ > >_______________________________________________ > >Emc-users mailing list > >Emc-users@lists.sourceforge.net > >https://lists.sourceforge.net/lists/listinfo/emc-users > > ------------------------------------------------------------------------------ > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > ------------------------------------------------------------------------------ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users