Jump to content

[Hardware, Plugin] Arduino based physical display + serial port io+ tutorial (24-11-19)


Recommended Posts

Given that the sketches you linked to work, try to run the following:

[COLOR=#339933]#include "LedControl.h"[/COLOR]
[COLOR=#666666][I]// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1[/I][/COLOR]
LedControl lc[COLOR=#339933]=[/COLOR]LedControl[COLOR=#009900]([/COLOR][COLOR=#0000dd]7[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]6[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]5[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]1[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#993333]void[/COLOR] setup[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR]
[COLOR=#009900]{[/COLOR]
[COLOR=#666666][I]// Initialize the MAX7219 device[/I][/COLOR]
lc.[COLOR=#202020]shutdown[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000dd]0[/COLOR][COLOR=#339933],[/COLOR][COLOR=#000000][B]false[/B][/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#666666][I]// Enable display[/I][/COLOR]
lc.[COLOR=#202020]setIntensity[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000dd]0[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]10[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#666666][I]// Set brightness level (0 is min, 15 is max)[/I][/COLOR]
lc.[COLOR=#202020]clearDisplay[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000dd]0[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#666666][I]// Clear display register[/I][/COLOR]
[COLOR=#009900]}[/COLOR]
[COLOR=#993333]void[/COLOR] loop[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR]
[COLOR=#009900]{[/COLOR]

long alt = 23456789; // Raising this so digits are different from digit positions

int tens;
int digit;

for(int i = 7; i > -1; i--) { //we need to start lowest digit first
// this isolates the i-th digit
tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

lc.setDigit(0, i, digit, false);
Serial.Print(i);
Serial.Print(' ');
Serial.Println(digit);
}

delay(70);
[COLOR=#009900]}[/COLOR]

Run this with your serial monitor open, it should read

7 9

6 8

5 7

4 6

3 5

2 4

1 3

0 2

and your display should read 23456789 if I am able to modify sketches correctly without an Arduino at hand.

Then try to replace my way of seperating digits with MrOnaks, which is a far more eloquent way of doing things, and see if it makes any difference. That is, replace

int tens;

with

int digitPlace = 1;

and


tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

With

    digit = (alt / digitPlace) % 10;
digitPlace = digitPlace *10;

Link to post
Share on other sites

Zitronen's approach sure is viable but he already knows my vague dislike of Strings on an Arduino. You might want to give his approach a shot though since it is working for him.

You can also replace your loop() function with this:


void loop()
{
// update KSP data
input();

byte digit;
byte digitPlace = 1;

for (byte i = 0; i < 8; i++) {
// this isolates the i-th digit
digit = ((unsigned long) (VData.Alt / digitPlace) % 10);
digitPlace = digitPlace *10;

lc.setDigit(0, i, digit, false);
}

delay(70); // roughly matches the default update frequency of KSPIO
}

This is extremely close to the code that I use myself to read the altitude and on my display it works.

You might get an error about the (unsigned long) typecast - if you do, try (uint32_t) instead but I doubt that works in the Arduino IDE.

Update

In case that also doesn't work, try this


void loop()
{
// update KSP data
input();

lc.setDigit(0, 0, ((unsigned long) (VData.Alt / 10000000) % 10), false);
lc.setDigit(0, 1, ((unsigned long) (VData.Alt / 1000000) % 10), false);
lc.setDigit(0, 2, ((unsigned long) (VData.Alt / 100000) % 10), false);
lc.setDigit(0, 3, ((unsigned long) (VData.Alt / 10000) % 10), false);
lc.setDigit(0, 4, ((unsigned long) (VData.Alt / 1000) % 10), false);
lc.setDigit(0, 5, ((unsigned long) (VData.Alt / 100) % 10), false);
lc.setDigit(0, 6, ((unsigned long) (VData.Alt / 10) % 10), false);
lc.setDigit(0, 7, ((unsigned long) VData.Alt % 10), false);

delay(70); // roughly matches the default update frequency of KSPIO
}

That's as simple as it gets.

Edited by MrOnak
Link to post
Share on other sites
Zitronen's approach sure is viable but he already knows my vague dislike of Strings on an Arduino. You might want to give his approach a shot though since it is working for him.

You can also replace your loop() function with this:


void loop()
{
// update KSP data
input();

byte digit;
byte digitPlace = 1;

for (byte i = 0; i < 8; i++) {
// this isolates the i-th digit
digit = ((unsigned long) (VData.Alt / digitPlace) % 10);
digitPlace = digitPlace *10;

lc.setDigit(0, i, digit, false);
}

delay(70); // roughly matches the default update frequency of KSPIO
}

This just displays 00000000 even after the scene loads and KSP serial detects the Com port

In case that also doesn't work, try this


void loop()
{
// update KSP data
input();

lc.setDigit(0, 0, ((unsigned long) (VData.Alt / 10000000) % 10), false);
lc.setDigit(0, 1, ((unsigned long) (VData.Alt / 1000000) % 10), false);
lc.setDigit(0, 2, ((unsigned long) (VData.Alt / 100000) % 10), false);
lc.setDigit(0, 3, ((unsigned long) (VData.Alt / 10000) % 10), false);
lc.setDigit(0, 4, ((unsigned long) (VData.Alt / 1000) % 10), false);
lc.setDigit(0, 5, ((unsigned long) (VData.Alt / 100) % 10), false);
lc.setDigit(0, 6, ((unsigned long) (VData.Alt / 10) % 10), false);
lc.setDigit(0, 7, ((unsigned long) VData.Alt % 10), false);

delay(70); // roughly matches the default update frequency of KSPIO
}

That's as simple as it gets.

Same again I'm afraid, just 00000000 and nothing else.

Given that the sketches you linked to work, try to run the following:

[COLOR=#339933]#include "LedControl.h"[/COLOR]
[COLOR=#666666][I]// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1[/I][/COLOR]
LedControl lc[COLOR=#339933]=[/COLOR]LedControl[COLOR=#009900]([/COLOR][COLOR=#0000dd]7[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]6[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]5[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]1[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR]
[COLOR=#993333]void[/COLOR] setup[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR]
[COLOR=#009900]{[/COLOR]
[COLOR=#666666][I]// Initialize the MAX7219 device[/I][/COLOR]
lc.[COLOR=#202020]shutdown[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000dd]0[/COLOR][COLOR=#339933],[/COLOR][COLOR=#000000][B]false[/B][/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#666666][I]// Enable display[/I][/COLOR]
lc.[COLOR=#202020]setIntensity[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000dd]0[/COLOR][COLOR=#339933],[/COLOR][COLOR=#0000dd]10[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#666666][I]// Set brightness level (0 is min, 15 is max)[/I][/COLOR]
lc.[COLOR=#202020]clearDisplay[/COLOR][COLOR=#009900]([/COLOR][COLOR=#0000dd]0[/COLOR][COLOR=#009900])[/COLOR][COLOR=#339933];[/COLOR] [COLOR=#666666][I]// Clear display register[/I][/COLOR]
[COLOR=#009900]}[/COLOR]
[COLOR=#993333]void[/COLOR] loop[COLOR=#009900]([/COLOR][COLOR=#009900])[/COLOR]
[COLOR=#009900]{[/COLOR]

long alt = 23456789; // Raising this so digits are different from digit positions

int tens;
int digit;

for(int i = 7; i > -1; i--) { //we need to start lowest digit first
// this isolates the i-th digit
tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

lc.setDigit(0, i, digit, false);
Serial.Print(i);
Serial.Print(' ');
Serial.Println(digit);
}

delay(70);
[COLOR=#009900]}[/COLOR]

Run this with your serial monitor open, it should read

7 9

6 8

5 7

4 6

3 5

2 4

1 3

0 2

and your display should read 23456789 if I am able to modify sketches correctly without an Arduino at hand.

Then try to replace my way of seperating digits with MrOnaks, which is a far more eloquent way of doing things, and see if it makes any difference. That is, replace

int tens;

with

int digitPlace = 1;

and


tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

With

    digit = (alt / digitPlace) % 10;
digitPlace = digitPlace *10;

Getting an error thrown up when I try to upload...

sketch_jan07a.ino: In function 'void loop()':

sketch_jan07a:26: error: invalid use of 'class Print'

sketch_jan07a:27: error: invalid use of 'class Print'

sketch_jan07a:28: error: 'class HardwareSerial' has no member named 'Println'

So the way I've been using my 7 segs is by converting the number to a string first using dtostrf(), then writing the string to the LEDs. This way you have better control of the formatting and you can also display letters and symbols.


char SSLED[9] = "--------";

...
byte decimal = 9; //decimal is where you want the decimal point, set it to >9 if you don't want it.

dtostrf(round(###put value here###),8,0,SSLED);
write7Segment(display, SSLED, decimal);


void write7Segment(byte display, char value[9], byte decimal)
{
for (byte j = 0; j<8; j++) {
lc.setChar(display,j,value[j],decimal==j);
}
}

I have a whole convoluted function for moving the decimal point around and displaying the unit on the lcd (see video in first post), I would post it here but it's kind of hard coded to use only 6 digits.

This is very promising as it sounds like you are using both LedSerial and a chip similar to the MAX7219. Where do I put this code... in Void Loop?

Link to post
Share on other sites

Well, my bad with a forgotten init and a capital letter. I was a work so I could not test it. Try this

#include "LedControl.h"
// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1
LedControl lc=LedControl(7,6,5,1);
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);

// Initialize the MAX7219 device
lc.shutdown(0,false); // Enable display
lc.setIntensity(0,10); // Set brightness level (0 is min, 15 is max)
lc.clearDisplay(0); // Clear display register
}
void loop()
{

long alt = 23456789; // Raising this so digits are different from digit positions

int tens;
int digit;

for(int i = 7; i > -1; i--) { //we need to start lowest digit first
// this isolates the i-th digit
tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

lc.setDigit(0, i, digit, false);
Serial.print(i);
Serial.print(' ');
Serial.println(digit);
}

delay(70);
}

And MrOnak, if I understand the syntax correct in the reference, I think typecasting looks like

alt = long(VData.Alt)

instead of

alt = (long)(VData.Alt)

. That might be the reason alt reads a bunch of zeroes.

And for sopmething completely different. I'd like to hook up a string of MAX7219's, a 74HC595 and some CD4021B's for various inputs and outputs. Is it possible for the three chips to share clock pin, and for the 74HC595 and MAX7219 to share data pin, so I can do it in 6 pins (clock, data in, data out, latch 1, latch 2, latch 3)?

Edited by Freshmeat
Link to post
Share on other sites

long() typecasts to a signed long. But I want to typecast to an unsigned long which the Arduino "language special" doesn't document. Hence the (unsigned long) variant. That's actually how it is done in C, only arduino thought wrapping another shroud of mystery over basic language constructs was required ;)

Anyway, long() might also work but I highly doubt that this is the problem. The code I'm pasting actually works on an LCD so.... I'm really out of ideas - for now.

Link to post
Share on other sites

Run this with your serial monitor open, it should read

7 9

6 8

5 7

4 6

3 5

2 4

1 3

0 2

and your display should read 23456789 if I am able to modify sketches correctly without an Arduino at hand.

Ok, updated and uploaded... but the display now shows 9-----00 (where - represents a blank digit)

Serial monitor shows a constant stream of 2 digit numbers scrolling up too fast to read.

I don't know if it is of any use but here is the data sheet for the type of chip I'm using (seems to be standard chip for most 7 segments arduino boards) https://www.sparkfun.com/datasheets/Components/General/COM-09622-MAX7219-MAX7221.pdf

- - - Updated - - -


char SSLED[9] = "--------";

...
byte decimal = 9; //decimal is where you want the decimal point, set it to >9 if you don't want it.

dtostrf(round(###put value here###),8,0,SSLED);
write7Segment(display, SSLED, decimal);


void write7Segment(byte display, char value[9], byte decimal)
{
for (byte j = 0; j<8; j++) {
lc.setChar(display,j,value[j],decimal==j);
}
}

Try as I might I can't find anywhere to paste these bits of code that doesn't just throw up a pile of errors... is there some code missing? Remember... I'm not a coder, I'm a prop builder :) Never assume I can fill in the blanks ;) I get there in the end with help though, managed to master switches, warning lights and analogue gauges, determined to crack this one too to complete my build!

Edited by Mulbin
Link to post
Share on other sites

@MrOnak: Thanks, I learn something new every day by this. Eventually, I probably will have to learn C, but I'd like to put it off as long as possible. @Mulbin: If you get rows of two single numbers on the serial monitor, I am pretty certain you get the right data out in the digit and i variables. Maybe try to increase from delay(70) to delay(500) so you can read the numbers on the serial. But I am at a total loss as to why they dont get written on the display.

Link to post
Share on other sites
long() typecasts to a signed long. But I want to typecast to an unsigned long which the Arduino "language special" doesn't document. Hence the (unsigned long) variant. That's actually how it is done in C, only arduino thought wrapping another shroud of mystery over basic language constructs was required ;)

Anyway, long() might also work but I highly doubt that this is the problem. The code I'm pasting actually works on an LCD so.... I'm really out of ideas - for now.

uint32_t, uin8_t and stuff all work just fine in the Arduino IDE, "Arduino" is just C (as in exactly the same as C) with some added libraries. You can also do low level stuff like PORTD = 0x00 or even inline assembly code in the IDE. It's just a bit primitive compared to a "proper" IDE.

Instead of trying to typecast stuff have you tried the built in round() function? Seems like you guys are stuck on some kind of weird type conversion problem. If that still doesn't work you can try my char array method.

Link to post
Share on other sites

@Zitronen: You're right of course. What makes me mad is that the Arduino reference (as an example) prominently documents int(), long() and other functions for typecasting, but makes no mention of the more ..hmm... traditional? way of (int) or (long) - or in fact (uint32_t). Since there is no unsignedlong() typecast wrapper in the Arduino IDE I believe that's a serious problem especially for people who don't have a C background when they start with the Arduino. Some tasks simply appear not to be solvable if all you have is the reference.

Of course it doesn't help that some of the more essential Arduino wrappers like digitalWrite() require so much more clock cycles and so much more memory (the library that includes them) that people frequently recommend getting a beefier microcontroller to solve trivial tasks. See this instructable for an admittedly not very indepth example of the performance hit with Arduino libraries: http://www.instructables.com/id/Arduino-is-Slow-and-how-to-fix-it/?ALLSTEPS

After saying all this, don't get me wrong. Arduino in my opinion is still the best option to get started with microcontrollers, partly of course because of the wrappers. However some of the wrapping goes too far (in my opinion, anyway) and the documentation available lacks an "where to go from here" section if you know what I mean.

Link to post
Share on other sites

@Zitronen Any chance you could spare the time to help me get my board running? Sounds like you've already got 7 segments working with LedControl and a Max7219, but the little bits of code you've shown aren't enough for a code noob like me to know what to do with!

Link to post
Share on other sites

Still waiting on parts for my panel....! Looks like it will take a while before I'm at the same stage (ha ha) as some of you chaps on here. I'm hoping to machine some parts for my meters today, these are going to use little stepper motors so I can get a 270 degree needle swing. I'm also planning on making a somewhat elaborate altitude meter with an embedded 7 segment display and a stepper driven needle. Hopefully this will come together OK, when I have more to display other than just hot air, I'll post some images.

I still have a few questions...

Although I'm going to be using the Arduino as my main board (actually a ChipKit Max32) I'm planning on running a number of other controls through one of the common USB MAME boards that you can on Ebay, amongst other places. Does anyone have any experience of these? For example, can keyboard actions such as time warp be assigned to buttons connected to one of these things?

This is what I'm talking about:

http://www.ebay.co.uk/itm/2x-ZERO-DELAY-ARCADE-USB-ENCODER-PC-TO-JOYSTICK-FOR-ARCADE-MAME-FIT-HAPP-PARTS-/261481039277?pt=UK_Video_Games_Coin_Operated_MJ&hash=item3ce17c05ad

-CF

Link to post
Share on other sites

@Mulbin: I think I got it!

I finally got time to hook up a MAX myself, and the problem with my code was the var tens. It need to be of type long instead of int, as I copy alt into it, and alt is larger than the range of int. Changing line 19 from "int tens;" to "long tens;" will make my example work. However, my code does only work when the input is 8 digits long, MrOnaks code (with a slight modifiation) is what you really is looking for.

Try this:

#include "LedControl.h"
// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1
LedControl lc=LedControl(7,6,5,1);
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);

// Initialize the MAX7219 device
lc.shutdown(0,false); // Enable display
lc.setIntensity(0,10); // Set brightness level (0 is min, 15 is max)
lc.clearDisplay(0); // Clear display register
}
void loop()
{

long alt = 23456789; // Raising this so digits are different from digit positions

long tens;
byte digit;

for(int i = 7; i > -1; i--) { //we need to start lowest digit first
// this isolates the i-th digit
tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

lc.setDigit(0, i, digit, false);
Serial.print(i);
Serial.print(' ');
Serial.println(digit);
}

delay(500);
}

If that works, try this in your KSP sketch (assuming you have initialized the display somewhere else)



input();

long alt;
long tens;
byte digit;

alt = long(Vdata.Alt);

for(int i = 7; i > -1; i--) { //we need to start lowest digit first
// this isolates the i-th digit
tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

lc.setDigit(0, i, digit, false);

}

This is also why MrOnaks code malfunctions, he starts by declaring digit and digitPlace bytes, when they need to be long. Note that you do not need them to be unsigned long, but you will need some form of checking to ensure that the value is within 8 digits by converting to km, Mm or GM as nescessary, something I am yet to figure how to solve in practice. Try his code again, but with small change:


void loop()
{
// update KSP data
input();

unsigned long digit;
long digitPlace = 1;

for (byte i = 0; i < 8; i++) {
// this isolates the i-th digit
digit = ((unsigned long) (VData.Alt / digitPlace) % 10);
digitPlace = digitPlace *10;

lc.setDigit(0, i, digit, false);
}

delay(70); // roughly matches the default update frequency of KSPIO
}

@CarlosFandango: I run quite a few functions, timewarp included, through a Logitech gamepad, so I cannot see why the MAME board should be unable to do so.

Edited by Freshmeat
Kept messing around
Link to post
Share on other sites

Try this:

#include "LedControl.h"
// Arduino Pin 7 to DIN, 6 to Clk, 5 to LOAD, no.of devices is 1
LedControl lc=LedControl(7,6,5,1);
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);

// Initialize the MAX7219 device
lc.shutdown(0,false); // Enable display
lc.setIntensity(0,10); // Set brightness level (0 is min, 15 is max)
lc.clearDisplay(0); // Clear display register
}
void loop()
{

long alt = 23456789; // Raising this so digits are different from digit positions

long tens;
byte digit;

for(int i = 7; i > -1; i--) { //we need to start lowest digit first
// this isolates the i-th digit
tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

lc.setDigit(0, i, digit, false);
Serial.print(i);
Serial.print(' ');
Serial.println(digit);
}

delay(500);
}

Progress... now it displayes 98765432 Still seems to be in reverse order but better than the random numbers before!

If that works, try this in your KSP sketch (assuming you have initialized the display somewhere else)



input();

long alt;
long tens;
byte digit;

alt = long(Vdata.Alt);

for(int i = 7; i > -1; i--) { //we need to start lowest digit first
// this isolates the i-th digit
tens = alt / 10;
digit = alt - (10*tens);
alt = tens;

lc.setDigit(0, i, digit, false);

}

This is throwing up an error...

KSPIODemo8.ino: In function 'void loop()':

KSPIODemo8:149: error: 'Vdata' was not declared in this scope

This is also why MrOnaks code malfunctions, he starts by declaring digit and digitPlace bytes, when they need to be long. Note that you do not need them to be unsigned long, but you will need some form of checking to ensure that the value is within 8 digits by converting to km, Mm or GM as nescessary, something I am yet to figure how to solve in practice. Try his code again, but with small change:


void loop()
{
// update KSP data
input();

unsigned long digit;
long digitPlace = 1;

for (byte i = 0; i < 8; i++) {
// this isolates the i-th digit
digit = ((unsigned long) (VData.Alt / digitPlace) % 10);
digitPlace = digitPlace *10;

lc.setDigit(0, i, digit, false);
}

delay(70); // roughly matches the default update frequency of KSPIO
}

Sadly no better, still just keeps displaying 00000000

Thanks for continued efforts though, I feel we must be getting closer!

Link to post
Share on other sites

zitronen, I've been looking at your git repository, and the most recent commit says it's for 0.16.0. Is 0.16.1 not uploaded yet? (also, yeah, that pull request was totally me. keen to know what you think about it. :) )

I was a little disappointed to find that the plugin doesn't provide any control of rovers and did a little digging. Looking at the kOS source, it seems the FlightCtrlState object has wheelThrottle and wheelSteer fields (see here and here). I'd be keen to add rover control, either as separate controls, or just emulate the default keybindings and set wheelThrottle and wheelSteer when modifying pitch and yaw?

Link to post
Share on other sites
Ok, it was far easier than I expected to get a 7 segment running! Wired the first one up and have also added the LedControl library and got the display to fire up a simple sketch.

http://i.imgur.com/MlhZ5b4.jpg

Next request... can anyone give me a sample arduino code to include in my code? Something to display some data, such as MET so I can start to get my head around how to code outputs for 7 segment.

I am using LedControl plugin via 8 digit 7 segments (can daisy chain them.. I have 6 boards currently!) each is running on a MAX7219 chip. Thanks in advance for any help!

Take this code :)

[EDIT: link updated] https://www.dropbox.com/s/ud69sks1u6z30kf/Demo_for_7segMAX7219_module_updated.zip?dl=0

I wrote a bunch of small functions to write numbers using these modules, partly thanks to some very kind members on this forum that pointed out some hardware bugs with these, and partly seeing everyone else's photos, I decided I'd sat on these for too long. I'll update my thread with pix soon :)

If you give this a go, and numbers are still not displaying, try pushing down on the actual displays; sometimes they can get unseated and drop a segment or a digit.

I really hope this helps, hate to see you struggling buddy! :)

EDIT: You will need to adjust for the number of displays you have hooked in, and what pins they connect to.

Edited by AmeliaEatyaheart
EDIT: link updated
Link to post
Share on other sites

Just had a look at your thread - looks like you're doing well! :)

Those 7 segment modules make a huge difference, once I got my act together it took me 3 days to troubleshoot, fix, and wire all the modules together - go for it! :D

If you're finding problems with your modules, KK4TEE posted a fix on my thread: http://forum.kerbalspaceprogram.com/threads/100977-Hardware-Custom-KSP-flight-panel-with-flight-computer?p=1577824&viewfull=1#post1577824

I found about half the modules in the batch I got had the fault, so test all boards individually :)

Link to post
Share on other sites
Take this code :)

https://www.dropbox.com/s/nmrvrhj1fj0es3v/Demo_for_7segMAX7219_module.zip?dl=0

I wrote a bunch of small functions to write numbers using these modules, partly thanks to some very kind members on this forum that pointed out some hardware bugs with these, and partly seeing everyone else's photos, I decided I'd sat on these for too long. I'll update my thread with pix soon :)

If you give this a go, and numbers are still not displaying, try pushing down on the actual displays; sometimes they can get unseated and drop a segment or a digit.

I really hope this helps, hate to see you struggling buddy! :)

EDIT: You will need to adjust for the number of displays you have hooked in, and what pins they connect to.

It works! so now I can display A 1234.56 But how do I get it to display data from KSP?

Link to post
Share on other sites

Adding wheel control is pretty straightforward. I've got the changes sitting in my fork now, but probably won't have time to test it properly and send another pull request until the end of the week. If you're keen, https://github.com/phardy/KSPSerialIO/tree/wheelcontrol

EVA control isn't impossible, but it isn't exposed the same way other fly by wire stuff is and looks pretty daunting to be honest.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...