Yeah good advice in here. I usually start with a beat and a bassline, it's often a simple one. I love simple basslines. Then listen to the rhythm of the bassline and the beat, and mess around on a synth and find out what sounds right. Like other's have said, don't make it too noodly, it will sound like it's going nowhere, tell a story with a melody. I think a melody has to "rhyme" most of the times if you know what I mean - I like a "question and reply" thing going on.
The sound of the synth/instrument is of importance too, it can make the same notes sound a lot different.
And yes, don't be afraid of trying arps and stuff like that, it can really make you come up with something that you hadn't thought of.