Changes for page Front I/O
Last modified by Kevin Wiki on 2024/07/07 22:48
From version
7.4
edited by Kevin Wiki
on 2024/07/05 10:16
on 2024/07/05 10:16
Change comment:
There is no comment for this version
To version
8.2
edited by Kevin Wiki
on 2024/07/05 14:00
on 2024/07/05 14:00
Change comment:
There is no comment for this version
Summary
Details
- Page properties
-
- Content
-
... ... @@ -216,13 +216,68 @@ 216 216 * fan LED (red & green) 217 217 * temperature LED (red & green) 218 218 * compute LED (unknown) 219 +* lock switch 219 219 220 -Each side is driven by each their PCA9554 shift register. The registers represent the following LEDs: (Note that Lock LED is only present for the LEFT side)221 +Each sides bank of LEDs are driven by each their PCA9554 shift register. The registers represent the following LEDs: (Note that Lock LED is only present for the LEFT side) 221 221 223 +(% border="1" %) 222 222 |=(% scope="row" %)Register|1|2|3|4|5|6|7 223 223 |=Device|Power LED Green|Power LED Red|Fan LED Green|Fan LED Red|Temperature LED Green|Temperature LED Red|Lock LED 224 224 225 225 To control each LED we shift either a 0 to turn off or 1 to turn on. Since each device shares a single red/green LED (power LED green & power LED red) setting both to 1 at the same time will always leave it red. That is when power LED green and power LED red are both enabled, red always takes precedence. 228 + 229 +Use following script to power LEDs one at a time: 230 + 231 +{{code language="c++"}} 232 +#include <PCA9554.h> // Load the PCA9554 Library 233 + 234 +PCA9554 ioCon1(0x24); // Create an object at this address 235 + 236 +uint8_t mapIO = 0b10000000; 237 + 238 +void shiftL() { 239 + mapIO = (mapIO << 1) | ((mapIO & 0x80) >> 7); 240 +} 241 + 242 +void write() { 243 + Serial.println("writing to PCA9554 device"); 244 + 245 + for (int i = 0; i < 8; ++i) { 246 + ioCon1.digitalWrite(i, (mapIO & (1 << i)) ? 0 : 1); 247 + } 248 +} 249 + 250 +void setup() 251 +{ 252 + Serial.begin(9600); 253 + Serial.println("Setup"); 254 + 255 + ioCon1.portMode(ALLOUTPUT); 256 +} 257 + 258 +void loop() 259 +{ 260 + write(); 261 + shiftL(); 262 + 263 + delay(500); 264 +} 265 +{{/code}} 266 + 267 + 268 +Controlling middle IO strip 269 + 270 +0 = 0000 271 +1 (green) = 0001 272 +2 = 0010 273 +1 + 2 = 0011 274 +3 = 0100 275 + 276 + 277 +There are 4 words, each containing 7 data bits. They do not 278 + 279 + 280 + 226 226 ))) 227 227 228 228