Instructables

server side bug

Recently I've been posting the odd code sample from Arduino sketches into answers.

I open the source view option of the rich editor, and paste the HTML copy from Arduino 1.xx
That's code with the  pre tags set start and end.
I close the source view, and my rich edit preview is fine.
I post the message, and all hell breaks loose - I see the "Instructables is down " message in the middle of the postings, and all the text becomes centred.

This is FF18, but the error seems to come from Instructables - or where would your "Instructables is down" come from

test PRE

int outPin = 11; // Output PWM signal
int buttonPin = 9; // Button input
int myPWM = 0;

void setup() {

pinMode(buttonPin, INPUT);// initializing button pin as input
pinMode(outPin, OUTPUT); // initializing output pin as output
}

void loop() {
  while (buttonPin==LOW);
  if (buttonPin==HIGH)
   {myPWM=myPWM+10;
    if (myPWM>100) myPWM=0;
    //Set PWM out
    analogWrite (outPin,myPWM);
    }
  while (buttonPin==HIGH) ;
}


end test
steveastrouk (author)  mikeasaurus1 year ago
Test, other FF18.0.1 test PRE

int outPin = 11; // Output PWM signal
int buttonPin = 9; // Button input
int myPWM = 0;

void setup() {

pinMode(buttonPin, INPUT);// initializing button pin as input
pinMode(outPin, OUTPUT); // initializing output pin as output
}

void loop() {
  while (buttonPin==LOW);
  if (buttonPin==HIGH)
   {myPWM=myPWM+10;
    if (myPWM>100) myPWM=0;
    //Set PWM out
    analogWrite (outPin,myPWM);
    }
  while (buttonPin==HIGH) ;
}

steveastrouk (author)  steveastrouk1 year ago
Err. So, identical browser, different PC, different behaviours.

Any ideas what could be happening on the faulty machine then Mike ?
Are both the same version of browser, and are they both updated with the latest update? We test with the most current available browsers on all platforms.

Assuming both browsers are the same, and there's no add-ons running to prevent the page from loading entirely, then your computer is probably just hungry for your delicious code and will not let you post until it's appetite is satiated.
steveastrouk (author)  mikeasaurus1 year ago
If I dig all your HTML out, I can't post it without the "client error" message.
Try it first with very little data in the PRE TEXTAREA. What are the parameters you are using for the TEXTAREA? Try these as a baseline and work from there:

textarea cols="75" name="code" readonly="readonly" rows="20" style="width: 600px; height: 294px;"
steveastrouk (author)  mikeasaurus1 year ago
Hi Mike,
Have you changed something ? It worked only a couple of weeks ago, from the same copy of Arduino.

This is the code I pasted


Steve
steveastrouk (author)  steveastrouk1 year ago
I get two copies of "client read error" from your end when I even try to post the code in-line.
steveastrouk (author)  steveastrouk1 year ago
Try this
/*
 
  The circuit:
   * LEDs from pins 2 through 11 to ground
  */


// these constants won't change:
const int ledCount = 12;    // the number of LEDs in the bar graph

int ledpins[] = {
  2, 3, 4, 5, 6, 7,8,9,10,11,12,13 };   // an array of pin numbers to which LEDs are attached
  //First 6 pins are the steady sequence pins
  //second six are the random number pins
int Ledsequence[] = {1,2,4,8,16,32,32,16,8,4,2,1}; //This is the flashing sequence
int Randomnumber =0;
int Tseq = 0;


void setup() {
  // loop over the pin array and set them all to output:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
    pinMode(ledpins[thisLed], OUTPUT);
  }
  randomSeed (analogRead(0));
}

void loop() {
  for (int ctr=0;ctr<12;ctr++)
   {
     Tseq = Ledsequence[ctr];
     if (Tseq & 1==1) {digitalWrite(ledpins[0], HIGH);} else {digitalWrite(ledpins[0],LOW);}
     if (Tseq & 2==2) {digitalWrite(ledpins[1],HIGH);} else {digitalWrite(ledpins[1] ,LOW);}
     if (Tseq & 4==4) {digitalWrite(ledpins[2],HIGH);} else {digitalWrite(ledpins[2] ,LOW);}
     if (Tseq & 8==8) {digitalWrite(ledpins[3],HIGH);} else {digitalWrite(ledpins[3] ,LOW);}
     if (Tseq & 16==16) {digitalWrite(ledpins[4],HIGH);} else {digitalWrite(ledpins[4] ,LOW);}
     if (Tseq & 32==32) {digitalWrite(ledpins[5],HIGH);} else {digitalWrite(ledpins[5] ,LOW);}
     Randomnumber =  random (32);
     if (Randomnumber & 1==1) {digitalWrite(ledpins[6] ,HIGH);} else {digitalWrite(ledpins[6] ,LOW);}
     if (Randomnumber & 2==2) {digitalWrite(ledpins[7] ,HIGH);} else {digitalWrite(ledpins[7] ,LOW);}
     if (Randomnumber & 4==4) {digitalWrite(ledpins[8] ,HIGH);} else {digitalWrite(ledpins[8] ,LOW);}
     if (Randomnumber & 8==8) {digitalWrite(ledpins[9] ,HIGH);} else {digitalWrite(ledpins[9] ,LOW);}
     if (Randomnumber & 16==16) {digitalWrite(ledpins[10] ,HIGH);} else {digitalWrite(ledpins[10] ,LOW);}
     if (Randomnumber & 32==32) {digitalWrite(ledpins[11] ,HIGH);} else {digitalWrite(ledpins[11] ,LOW);}
     delay(1000);
}

}

steveastrouk (author)  steveastrouk1 year ago
AH ! Its the SPECIFIC HTML from my Arduino programming software.
The code above ISN'T the code I tried to post.
Hey Steve,

So...problem solved?
steveastrouk (author)  mikeasaurus1 year ago
No, I have code from the same copy of Arduino, one sketch posts, the other fubars the website. I can't even PM you my code, because it doesn't like THAT either !
I made this HTML PRE TEXAREA:

with the image attached to this comment below
cap2013.jpg
Steve, are there any templated classes in your own actual code? Template code cannot be simply pasted into HTML because of the presents of angle-bracket delimited strings. The latter fools any HTML parser into thinking they are tags (and unrecognized tags) at that.
steveastrouk (author)  kelseymh1 year ago
I can't even post the code I have to show you.....

Allegedly, no, and it won't let me use "Forum friendly" code EITHER
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!