Main Site Documentation

Music module interfering with serCam


#1

Hello. I am using the
https://www.ghielectronics.com/community/codeshare/entry/368
custom music module so I can use filestream from the SD card.

I simply created a music.cs and added the code in there and it worked fine and i got the audio to play back.

I connected all other modules for my project and the code suddenly wont do anything when I start debugging. I worked out by elimination of all the other parts it is the sercam that causes it.

the code is literally just

using System;
using System.IO;
using System.Threading;
using Microsoft.SPOT;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;


namespace GadgeteerApp28
{
    public partial class Program
    {
        void ProgramStarted()
        {
            
            music.MusicFinished += new Music.MusicFinishedPlayingEventHandler(music_MusicFinished);
            sdCard.SDCardMounted += new SDCard.SDCardMountedEventHandler(sdCard_SDCardMounted);

            music.SetVolume(200);

            Debug.Print("Program started");
        }

        void sdCard_SDCardMounted(SDCard sender, GT.StorageDevice SDCard)
        {
            Debug.Print("SDCard mounted");

            FileStream fileStream;

            fileStream = new FileStream(@ "\SD\Audio\Audio-1.mp3", FileMode.Open);

            //Play the FileStream
            music.Play(fileStream);
            Debug.Print("Playing Audio-1.mp3");

            //wait until audio is over
            while (music.IsBusy)
                Thread.Sleep(10);


        }

        void music_MusicFinished(Music sender)
        {
            // Program will crash when switching to the 
            // next song if we don't have this event handler

            Debug.Print("Finished playing this song");
        }
    }
}

When sercam is connected the output window doesnt even show program started.
when is it not connected it works fine.

I can provide more information but as i said no error is shown.

Thank you for help in advance


#2

Welcome to the forum David!

Do you mean that when you physically connect the sercam, or do you mean when you logically connect the sercam on the Gadgeteer designer? And on what mainboard and what socket are music module and sercam connected?


#3

Hey sorry about this, it was due to faulty wire that i used to connect sercam. It just caused it not to do anything. I replaced the wire and everything works fine. Thanks for help anyway! :slight_smile:


#4

This is interesting. I have thrown a few brand new yet faulty Gadgeteer cables away recently. I thought it was just my bad luck, but it seems it is not…


#5

Idea: cable test program… Plug a cable into two sockets on same board and run some test-code…is that possible?


#6

Thats waay better than 0% - whats the method, and what are the wires testable?

Or…maybe a new module for cable testing would be feasible?


#7

I’d prefer working cables that do not need testing :slight_smile:


#8

Hello.
David, how you insert the code from https://www.ghielectronics.com/community/codeshare/entry/368 ??

Can someone to help me?

many thanks!