Oct 6, 2020 #1 D Djsarkar Member level 3 Joined Jul 27, 2020 Messages 55 Helped 0 Reputation 0 Reaction score 1 Trophy points 8 Activity points 301 Hi, I am looking help to understand following code because I do not understand programming for Arduino **broken link removed** I have PIC18F45K80. I am using MPLABX 5.40 and XC8 2.30. Code: // Arduino test code: int redpin = 11; // select the pin for the red LED int bluepin = 10; // select the pin for the blueLED int val; void setup () { pinMode (redpin, OUTPUT); pinMode (bluepin, OUTPUT); Serial.begin (9600); } void loop () { for(val=255;val>0;val--) { analogWrite (11, val); analogWrite (10, 255 - val); delay(5); } for(val=255;val<255;val++) { analogWrite (11, val); analogWrite (10, 255 - val); delay(5); } } There are two Reverse for loop in code What's the meaning of following two line in code? analogWrite (11, val); analogWrite (10, 255 - val);
Hi, I am looking help to understand following code because I do not understand programming for Arduino **broken link removed** I have PIC18F45K80. I am using MPLABX 5.40 and XC8 2.30. Code: // Arduino test code: int redpin = 11; // select the pin for the red LED int bluepin = 10; // select the pin for the blueLED int val; void setup () { pinMode (redpin, OUTPUT); pinMode (bluepin, OUTPUT); Serial.begin (9600); } void loop () { for(val=255;val>0;val--) { analogWrite (11, val); analogWrite (10, 255 - val); delay(5); } for(val=255;val<255;val++) { analogWrite (11, val); analogWrite (10, 255 - val); delay(5); } } There are two Reverse for loop in code What's the meaning of following two line in code? analogWrite (11, val); analogWrite (10, 255 - val);
Oct 6, 2020 #2 KlausST Advanced Member level 7 Joined Apr 17, 2014 Messages 26,108 Helped 4,916 Reputation 9,857 Reaction score 5,763 Trophy points 1,393 Activity points 175,452 Hi, lucky me. I have internet. And an internet search. I simply input "arduino analogwrite" and get a lot of useful results. Best is: a link to the original arduino reference. Try it. I assume it will work for you, too. Klaus
Hi, lucky me. I have internet. And an internet search. I simply input "arduino analogwrite" and get a lot of useful results. Best is: a link to the original arduino reference. Try it. I assume it will work for you, too. Klaus