Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
firmware code for LED control
#2
(08-12-2018, 02:21 AM)Travis Wrote: Hi Josh,

Regarding the Port interface: I wanted to run our emitter through the LED port so that I can control the sensitivity of our photogate (we don't need LED's since we're using video monitors).

I need to initialize the LED at startup in the firmware, it looks like the code will relate to the PWM, however there are two locations for this, one is pwmWrite (which looks like it may control the Bpod status LED) and the other relates to the SPI, which I recall from our previous communications relates to ethernet communication. 

My guess is that you initialize the emitter in the startup to always be on, and I'd like to do that for the LED port (then use the potentiometer to adjust sensativity.)

I saw in a previous thread that the emitter is on Ethernet jack 4, LED on jack 3.

Question 1: Is the emitter initialized at startup to always be on. If so then in the setup I could just swap the emitter line for the LED line and it would turn the LED port on at startup.

Question 2:, if (1) isn't true, then do you have any suggestions for coding this in the firmware?

If you have any concerns with doing this let me know.

Thanks!

I think I found it!!! In the main firmware code:

// Configure digital output channels
  for (int i = 0; i < nOutputs; i++) {
    switch (OutputHW[i]) {
      case 'D':
      case 'B':
      case 'W':
      case 'V':
        pinMode(OutputCh[i], OUTPUT);
        digitalWrite(OutputCh[i], LOW);
      break;
      case 'P':
        pinMode(OutputCh[i], OUTPUT);
        analogWrite(OutputCh[i], XXX);

Where XXX is the starting point for the LED lights!, I changed it to 255 and it turned them all on, and I can adjust them with the potentiometer, woo hoo!

T
Reply


Messages In This Thread
firmware code for LED control - by Travis - 08-12-2018, 02:21 AM
RE: firmware code for LED control - by Travis - 08-12-2018, 03:30 PM
RE: firmware code for LED control - by Josh - 08-17-2018, 12:31 AM

Forum Jump: